Okay got it, and what is github redirect url?
I checked your project and no request is being made to api.imda.cl
Maybe you're running the account.get() function in the server side of your next project?
In that case you wont get cookie unless you're going to use a cookie jar or JWT
What I mean is the account login and getting should run from the intranet.imda.cl frontend code, the code that is exposed to the end user.
In what part of your code are you running appwrite.account.get()?
I have disabled to make some debug testing, but even without call to account.get() the cookie should be created
It should but only if the function createOAuth2Session is being execute in a the frontend
Where you run this functions?
Oh now I see it
My bad
I run createOAuth2Session when I click the button
const login = () => createOAuth2Session();
<Button className={classes.loginButton} onClick={login}>Iniciar sesión</Button>
Can you add at the the flow of checking if the account is logged in in the component mounting point? Maybe something like this?
const account = new Account(client);
try {
const user = await account.get();
console.log(user.email);
} catch (e) {
console.log('User is not logged in');
}
Done I can see the user email, so the session is created, it just doesn't create the cookie 🤔
Good, In Appwrite you don't need the cookie The flow for your app can be something like this
- Check if the user is logged in
- if indeed is logged in then store the user object in a global state
- Then show view conditionally based on the user state
Is that make sense?
I have been working with the cookie since v0.7.x 🤔 (not in production)
I can see in the code that response includes a cookie: https://github.com/appwrite/appwrite/blob/master/app/controllers/api/account.php#L613
I think I got it If you would go to this url https://api.imda.cl/v1/ you would see the cookies The cookies are connect to the Appwrite endpoint
if you were able to get the email, then there is a session/cookie (unless there was the x-local-fallback header in the request) 🧐
what makes you say there is no cookie?
in the application tab there is no cookie, although I see it when I try it in localhost 🤔
but as @Binyamin mention if I go to https://api.imda.cl/v1/ the cookie is there
so the subdomain intranet.imda.cl can't see the cookies from api.imda.cl 🤔
I'm looking information why is that happening
It doesn't need to as the session management is between the user and the Appwrite engine
uhhh not exactly....the client app will send the cookie if hte browser has the cookie...that's probably why the account.get() worked
you're right If I see the output of the cookies with (nextjs)
console.log(req.cookies);
I can see the cookie setted
I'll change this as resolved as my question was answered, thank you both @Steven @Binyamin
✅ [Solved] Droplet and App in DigitalOcean
✅ [SOLVED] Droplet and App in DigitalOcean
Recommended threads
- Invalid token passed in the request
Hello, I have an issue using updateMagicURLSession. I send the email using sendMagicLink, which works fine. When i click the link in the email i get the invali...
- how can i make a relationship between a ...
i want to relate the $id from users auth table in appwrite with other column in my table user_profile. because is the same user... how can i have exactly the s...
- Google login on mobile not working
Hi the gg login auth in mobile not working. No error show. But the user couldnt login in Attached is the video. Desktop is working well and im using custom doma...