Heyo, this should work fine, right?
const handleDiscordLogin = async () => {
account.createOAuth2Session(
"discord",
`${process.env.NEXT_PUBLIC_DOMAIN}/account`,
`${process.env.NEXT_PUBLIC_DOMAIN}/login?failure=true`
);
};
Getting Missing redirect URL, but I wouldn't know where else to add it.
And assistant is giving me:
account.create_oauth2_session(
provider='google',
success='https://your-website.com/success',
failure='https://your-website.com/failure'
)
Which is very incorrect <:1lolol:638463120632709144>
Okay.. so it seems that using variables doesn't work? I have to use hardcoded values. Doesn't make sense in my point of view, but sure?
OAuth2 issues
So, after creating a OAuth2 session, what then?
It should redirect back to the success var and you should now be logged in?
Strange. I would double check the vars are set correctly, and actually accessible here.
I don't get any auth cookies, local storage, nothing.
where are you checking this?
Well, I am using the SDK for this, I thought (just like the login part) it should do this automatically? I check in the browser itself
so cookies are tied to the domain, not the app. If your appwrite endpoint is at appwrite.example.com and your app is on example.com, the domain would be appwrite.example.com so you'd have to go there to check for the cookie
local storage isn't used for oauth
Ah okay, how would I get the cookies on example.com instead?
if you're not using SSR, it's fine for the cookie to be on appwrite.example.com if your app is on example.com. When your request happens from example.com to appwrite.example.com, the cookie will still be sent
Thanks!
[Solved] OAuth2 issues
Recommended threads
- Error upgrading from 1.8.1 to 1.9.0
DO Self-hosted server failed to upgrade with this error "Error response from daemon: client version 1.52 is too new. Maximum supported API version is 1.42". U...
- MariaDB refuses to connect to appwrite
Earlier, I tried updating my Appwrite version from 18.1.x to the latest release because my Flutter package required it to function properly. I used the official...
- Custom API domain is unreachable
Earlier my custom api domain was working fine. Now it seems to be offline without a trace a few hours later. I didn't change anything, all the relevant DNS reco...