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
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here 🙂 I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...