-
Notifications
You must be signed in to change notification settings - Fork 4.4k
🐛 Bug Report: GitHub OAuth2 Not Working SvelteKit #5858
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@bitlogist, thanks for raising this issue! 🙏🏼
This is expected. On the web, the flow is:
The OAuth2 code is sent to Appwrite and Appwrite exchanges it for the access token to authenticate the user and create an Appwrite session. When the user is redirected from Appwrite to your app, a cookie is set for the session. At that point, if your app is able to make use of the cookie, it will be able to make the related API calls to Appwrite. To ensure your app can use the cookie, you'll need to either
Another thing to point out is the const urlParams = new URLSearchParams(window.location.search)
const code = urlParams.get('code')
console.log(code) // nothing never executes. When the user is redirected back to
After the user is redirected back, if everything is successful, there should be a cookie set and API calls to Appwrite should work. So, you can use the Get Session API to get the current session which will have a I hope that clarifies things. |
Hi @bitlogist 👋 following up on this, did you have a chance to look at @stnguyen90's comment ☝️ |
Is it not possible to use OAuth without 3rd party cookies? |
Yes, make it a 1st party cookie with the 2nd option i suggested.
|
I'm not sure if I can make it a subdomain because my SvelteKit app is deployed on vercel. Thanks anyway, though. |
@bitlogist, do you need anything else or can this be closed? |
👟 Reproduction steps
👍 Expected behavior
I should be able to access the user's GitHub details. The
createOAuth2Session
function does not return anything.👎 Actual Behavior
OAuth and redirection was successful but no code parameter was passed onto my application.
🎲 Appwrite version
Appwrite Cloud
💻 Operating system
Linux
🧱 Your Environment
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?
The text was updated successfully, but these errors were encountered: