Back

enable cookies

  • 0
  • Accounts
  • Web
  • Cloud
mitsy0_0
3 Jul, 2023, 07:19

How can I enable cookies on users end? I am using github OAuth

TL;DR
To enable cookies on the user's end and use GitHub OAuth, you need to ensure that the Appwrite API runs on the same top-level domain as your web app. You can achieve this by adding a custom domain in your project settings. After making changes to your DNS settings and connecting the domain to Appwrite, cookies should be set properly. Additionally, make sure to replace the endpoint in your code with the new domain and update the redirect URL in your GitHub app. This way, browsers should trust the cookies, and users should be able to log in successfully. If you encounter any issues or confusion, feel free to reach out for help
Meldiron
3 Jul, 2023, 10:51

Hey there πŸ‘‹ While this works out of the box in most browsers, some have extra security rules regarding first party cookies. To solve it, you need Appwrite API to run on same top-level domain as your web app. That means, if your app was at facebook.com, you should have Appwrite running on api.facebook.com, or appwrite.facebook.com, or similar.

To achieve this, you can go to your proejct settings and add a custom domain. After doing changes to your DNS settings and connecting that domain to Appwrite, you should be good to go. Make sure to replace endpoint in your code with your new domain, as well as the recirect URL in GitHub app.

With those changes, cookies should be set properly, browsers should have the trust and user should be successfully logged in.

Please ping me if something seems off, doesnt work, or is too confusing πŸ™

mitsy0_0
3 Jul, 2023, 11:32

okay so my app is hosted on vercel: https://app-name.vercel.app/

mitsy0_0
3 Jul, 2023, 13:49

I havent really bought a domain

Drake
3 Jul, 2023, 15:34

If you're testing, you can edit your hosts file. Otherwise, in order for others to access your app in production, you'll need a domain

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more