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
- Running into a server error on my self-h...
Hey everyone, I'm running into a server error on my self-hosted setup after updating to v1.19.0. The issue only happens during user creation and deletion. Ever...
- Storage System
Hey guys, quick question regarding massive storage scaling. I’m working in digital forensics and I’m constantly dealing with huge binary disk images, usually be...
- _APP_OPTIONS_ROUTER_PROTECTION
Hi Everyone, I just setup a fresh 1.9.0 on a server. Configured everything and now when i try to connect to appwrite for first time setup i get a _APP_OPTIONS_R...