[Solved] How to get `cookieFallback` when making requests using Web SDK?
- 0
- Resolved
- Self Hosted
- Accounts
- Web
Can you share a picture?
So I can get a better understanding
I saw that the subsequent requests had a cookie header. I didn't check if it had a x-fallback-cookies header
Just 4mins
This is the flow of Appwrite cookies logic.
If the fetch added native browser cookies that can mean the maybe your browser do accept cookies.
This is part of Appwrite client call function
let options: RequestInit = {
method,
headers,
credentials: 'include'
};
if (typeof window !== 'undefined' && window.localStorage) {
headers['X-Fallback-Cookies'] = window.localStorage.getItem('cookieFallback') ?? '';
}
/* More code */
const response = await fetch(url.toString(), options);
You can see the setting of credentials: 'include' which tell the browser to pass any cookies and the adding of fallback one.
so in this screenshot you can see -> create account POST, OPTIONS request -> create session with email POST, OPTIONS requst -> get accout GET request
now
here you were right about x-fallback-cookies being present in the request headers
but also the cookie header is set too!
So it looks like your browser do save the cookies.
in cookieStorage there is no cookies
this is localStorage
Ohh gotcha
You won't see the cookies because the not saved for the localhost domain, but for the Appwrite one.
So in order for you to be able to see them, you'll need to go to some Appwrite url like so
https://cloud.appwrite.io/v1/account?project=6469040898e19fe9052c
Replace this ID with your project ID.
Then you'll have access to how the browser stores all the cookies for the current user.
Ohh
Yes
Cross checked just now
Thx!!
<:appwriteupvote:899677724615016528>
about the 1st question:- Does websdk have some way to return the fallback cookie on a successful response
I have a use case for this thing
(The use case is described in the post description)
I think that verification do pass in localhost (and in your react native) so it seems like no.
Oh okay then
[Solved] How to get cookieFallback when making requests using Web SDK?
Recommended threads
- Domain is owned by a different organizat...
Hi Appwrite team, I'm trying to add my custom domain **futlive9.com** to my project, but I'm getting the error: "Domain is owned by a different organization." ...
- CreateRow is doing ListRows on self-host...
### setup ``` appwrite 1.9.5 self-hosted bun 1.3 node-appwrite 27.1.0 ``` ### issue Im running a function on a self hosted 1.9.5 with "node-appwrite": "^27.1.0...
- Local function execution results in HTTP...
Hi all, I'm trying to develop a new function on my Ubuntu 24.04 machine running the latest version of docker. I've read through the documentation to install and...