The user had OAuth2 issues, but it was later solved. The solution was to check for the cookie on appwrite.example.com instead of example.com. The user also mentioned using the SDK but wasn't getting any auth cookies or local storage. They were advised to double-check the variables and make sure they were accessible. The user also questioned the use of hardcoded values instead of variables, but it was confirmed that hardcoded values were necessary. The user provided an example code snippet for handling Discord login.
fafa
Rank 4: Virtual Machine
Nov 25, 2023, 14:29
Getting Missing redirect URL, but I wouldn't know where else to add it.
fafa
Rank 4: Virtual Machine
Nov 25, 2023, 14:33
And assistant is giving me:
JavaScript
account.create_oauth2_session(
provider='google',
success='https://your-website.com/success',
failure='https://your-website.com/failure'
)
Which is very incorrect
fafa
Rank 4: Virtual Machine
Nov 25, 2023, 14:43
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?
fafa
Rank 4: Virtual Machine
Nov 25, 2023, 15:32
OAuth2 issues
fafa
Rank 4: Virtual Machine
Nov 25, 2023, 15:38
So, after creating a OAuth2 session, what then?
ideclon
Rank 5: Hypervisor
Nov 26, 2023, 07:17
It should redirect back to the success var and you should now be logged in?
ideclon
Rank 5: Hypervisor
Nov 26, 2023, 07:18
Strange. I would double check the vars are set correctly, and actually accessible here.
fafa
Rank 4: Virtual Machine
Nov 26, 2023, 08:07
I don't get any auth cookies, local storage, nothing.
Drake
Nov 27, 2023, 16:48
where are you checking this?
fafa
Rank 4: Virtual Machine
Nov 27, 2023, 16:49
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
Drake
Nov 27, 2023, 16:56
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
Drake
Nov 27, 2023, 16:57
local storage isn't used for oauth
fafa
Rank 4: Virtual Machine
Nov 27, 2023, 16:57
Ah okay, how would I get the cookies on example.com instead?
Drake
Nov 27, 2023, 16:58
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