Back

How to validate login

  • 0
  • Users
  • Accounts
  • Web
Arth
3 Apr, 2023, 14:24

I've updated my code snippet

TL;DR
User is seeking assistance on how to validate login. They mention that Appwrite automatically sets session cookies and browsers handle them. User is unsure about the use of local storage and asks for alternative options. They also mention that Google login is not generating cookies. They inquire if this is due to a problem with cookies. Another user suggests using custom domains to resolve the cookie issue. User expresses frustration and mentions their attempt to find another solution. Another user suggests storing the user in local storage before navigating to the dashboard. The code snippet has been updated. Solution: 1. Ensure that the frontend app and the API endpoint share the same base/register
Arth
3 Apr, 2023, 14:24

this one

Arth
3 Apr, 2023, 14:24

should store the user in localstorage then navigate to dashboard

Govind
3 Apr, 2023, 14:41

not working

Govind
3 Apr, 2023, 14:42

but it's fine

Govind
3 Apr, 2023, 14:42

I will try to find other way

Drake
3 Apr, 2023, 18:05

oauth2 requires cookies and your browser may be blocking cookies if the appwrite cookie is not a 1st party cookie. This is where custom domains comes in: https://appwrite.io/docs/custom-domains

Govind
3 Apr, 2023, 18:08

Hey Steven thank God you are here 😁

Govind
3 Apr, 2023, 18:11

I have created A record for the appwrite but don't have a cname record

Govind
3 Apr, 2023, 18:12

Is this a problem for cookie ?

Govind
3 Apr, 2023, 18:12

Because as I can see after successful Google auth login there are no cookies in local storage

Drake
3 Apr, 2023, 18:18

long term, in production, local storage should not be used

Drake
3 Apr, 2023, 18:18

the point is the front end and the endpoint the front end uses needs to share the same base/registerable domain

Govind
3 Apr, 2023, 18:27

Then instead of local storage what should be used ?

Drake
3 Apr, 2023, 18:30

cookies and it should be done automatically if everything is set up correctly

Govind
3 Apr, 2023, 18:52

for email login cookies are generating automatically

Govind
3 Apr, 2023, 18:52

but for google login it is not generating

Govind
3 Apr, 2023, 18:53

actually i didn't get what you said . . . . . πŸ˜…

safwan
3 Apr, 2023, 18:56

so if your frotned app is on example.com, the api endpoint that your frontend app uses must be *.example.com/v1

Govind
3 Apr, 2023, 18:56

Yes

Govind
3 Apr, 2023, 19:27

Then what ?

safwan
3 Apr, 2023, 20:08

you said you didn't understand. I just explained

Drake
3 Apr, 2023, 20:41

nothing else...appwrite automatically tries to set session cookies and browsers should automatically handle the session cookies

Govind
3 Apr, 2023, 23:23

Ok

Govind
4 Apr, 2023, 05:44

thanks buddy

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