Hi. I have a problem while doing fetch from the fr...
# support-questions
Hi. I have a problem while doing fetch from the front end to my backend I get 401 non-authorize. In docs, it said that if 8using fetch no actions are needed, what I'm missng
Hi. Do you have an active session on the frontend?
if so can you show me what kind headers are being sent with your fetch request?
Session is active. I did check it with await Session.doesSessionExist()
I sent only content type header. I haven't found any information about header that need to be included
You don't need to set any headers, but there is likely a problem with the setup. What I want to make sure is that the cookies are being sent, that should help nail down the problem.
One guess is that there is an issue with api domain and/or session scope on the frontend. Have you set those appropriately?
So I dont get any cookies
Could you show me the headers of the sign in response and the request that's failing?
are the API handling the sign in the same as the one where the request is failing?
{ host: 'localhost:3000', connection: 'keep-alive', 'content-length': '100', rid: 'anti-csrf', 'user-agent': 'Mozilla/5.0 (X11; Linux aarch64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.188 Safari/537.36 CrKey/1.54.250320', 'content-type': 'application/json', accept: '*/*', origin: '', 'sec-fetch-site': 'cross-site', 'sec-fetch-mode': 'cors', 'sec-fetch-dest': 'empty', referer: '', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8,pl;q=0.7' }
where I can get sign in headers if everything handled by supertokens library?
from the network tab in the dev tools
also, could you share the configs of the backend and the frontend SDK?
very strange I can't sign out now) I been doing that before but now I get response 200 but I still have active session
can you check what cookies are set in your browser? you should a few set both on for the frontend and the backend domain.
i can't check what cookies I send because I'm using passwordless auth. And requests are empty after redirection
not cookies but headers
You can tick "Preserve log" to keep them. it's near the top right of the network tab
So those are the frontend headers, any set for the backend domain?
Btw now when I use sign out method I get more cookies....
Can you include the domain and path in the screenshot as well?
showing up twice means that either the config changed or something strange is going on.
this is shown after I signed in
you need response hedaers as well?
I'd need the response headers of the request signing you in (
in this case)
hmm, can you hover over those yellow triangles?
oh, that's the problem
you could try and solve this by setting
in the backend config to "none", but that requires
set to true which means you'd have to use https
the easier way to solve this would be to use localhost for both front and backend in local development
different ports are fine.
ok now at least I can sign out)
let me try api call
yes it's working.
Sorry for that. It actually 100% my bad.
Thank you for your help!
happy to help πŸ™‚ this isn't like an obvious mistake, don't worry πŸ™‚
It is because like I said before sign-in and sign-out were working. But I came back to my project after some time and my did change local host to ip address myself)
I will be implementing microservice authorization so definitely there will be some questionsπŸ˜€