[Solved] How to get `cookieFallback` when making requests using Web SDK?
- 0
- 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
- Getting Error On self host SSL update
Hi, I am using app write for my app backend version i am using is 1.6.2 yesterday my ssl is expired and now i am not able to renew it because of it my app is no...
- import csv "Document already exists"
When I try to import a csv file to an already existing database, I keep getting "Document Already Exists" I thought that when I import and a document with the ...
- deploy denied!
so i was getting this error this my website, so i setup an empty branch and started from scratch. I Installed " git clone https://github.com/appwrite/starter-fo...
