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
- Project is currently blocked
When accessing the Appwrite console, I receive the message: "Project is currently blocked. Access to this project is restricted. Contact support if the issue pe...
- Does 1.9.0 Self Hosted have MongoDB Atla...
I have been playing with the new 1.9.0 update and I am really excited for the MongoDB support. I wanted to ask though if at the current time Appwrite supports b...
- {"code": 1008, "message": "Invalid Origi...
Nothing has changed in my application or console settings so I'm curious as to what I need to do to fix this. I already have the client registered so I'm not en...