Specific to supertokens-python with fastapi: I am ...
# support-questions
p
Specific to supertokens-python with fastapi: I am getting unauthorized when trying to pass a body(pydantic schema) in a post request to an endpoint with
session: SessionContainer = Depends(verify_session())
. In the the endpoint definition parans, does the order matter? (Schema and Depends)
r
Specific to supertokens-python with fastapi: I am getting unauthorized when trying to pass a body(pydantic schema) in a post request to an endpoint with
session: SessionContainer = Depends(verify_session())
. In the the endpoint definition parans, does the order matter? (Schema and Depends)
I don’t think that the order should matter
I don’t think so that the order should matter
p
upon inspection of the request headers I see that on my post request the cookies are not being attached, while in a test get request they do get attached
both (post and get) endpoints are protected with
session: SessionContainer = Depends(verify_session())
r
Are you sending access-control-allow-credentials to true? That should happen automatically if you are using our frontend SDK and the interceptors are getting applied
p
both get and post functions use the same send method, with access-control-allow-credentials set to true
r
Can I see the request headers for post?
Interceptors are not getting applied
p
and that's the get
r
What’s the request url for post and what’s it for get?
p
r
Hmm
Is there an OPTIONS API call before the get or post is made? What’s the response of that?
What’s strange is that the post request is not getting the interception applied
p
there no OPTIONS call now, but pretty sure I've seen those before... can those by cache'd?
r
Nope those can’t be
p
yes, do you see anything strange on the `send`function above? with the fetch
cause that's the only difference between the two calls
r
Hmm
I’m not sure what’s wrong here. Will have to debug this like we did yesterday.
p
._.
I'll find an hour
r
It’s probably some tiny config error…
Do you see any console logs when making get or post request?
p
frontend or backend?
r
Frontend
p
like in
send
function? yes
r
I mean the browser console
p
I'm now gonna test two endpoints
yes. console.logs when making the requests
r
No I mean the browser might give an indication as to why it’s not attaching cookies
So when you make the get or post calls, do you see any logs in the browser console?
p
ah, no
r
Hmm
So I think the first thing to debug here is why the interception is not being applied
Similarity to how we did yesterday
p
w8
I'm pretty sure it's related to my original question, about the endpoint also receiving a pydantic Schema
I made and tested these two endpoints
which use path value instead of body/schema
the second one is secure and as you see above it worked well
the one not working, on the other hand, looks like this:
r
The frontend not sending cookies has nothing to do with the backend setup in this case though
The request that’s not working, can I see the full request screenshot? Including the url?
Is this happening on the server side?
p
no
r
I’d you remove the body from the request that’s not working, does it send the cookies?
Try to comment out the stuff in the if (data) block and see if they request now sends cookies
p
no, I get the same headers
ok
w8
w8 that's actually what I just did by not sending any body
r
Huh?
p
it does not send the cookies
by removing the body/data, that section was not called. Cookies were not included
r
Can you add a debugger and see if it’s coming in the interception of the SDK?
Like we did yesterday?
p
mm I'll try
r
@User I’m available for a call now
R u free?
p
yes
r
Ok great
p
just sent an OPTIONS before
thanks so much, send me a link and Ill join
2 Views