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
- Appwrite Sites: ERR_TOO_MANY_REDIRECTS o...
So, my domain was working perfectly fine with Vercel. I was using cloudflare CDN (still am) but CNAME was DNS-only. I switched over to appwrite, CNAME is still ...
- How to disable appwrite/embedding from s...
Hi everyone! I'm currently running a self-hosted instance of Appwrite. For my current use case, I don't need the AI/embedding features, and I noticed the `app...
- Invalid type for attribute 'email': emai...
I'm using the node-appwrite SDK to create a table, the column payload looks like this: ```json [{"key":"email","type":"email","required":true, "size": 512}] ``...