https://supertokens.com/ logo
Title
a

AntonyBush

10/24/2022, 3:26 PM
I'm getting unauthorized (401) error while GET request from the backend (Django). Both frontend and backend has the same cookies. Earlier I used to get access token in the local storage but now there's no access token.
r

rp

10/24/2022, 3:35 PM
Hey. Can you enable backend debug logs and show me the output?
a

AntonyBush

10/24/2022, 3:50 PM
"OPTIONS /auth/authorisationurl?thirdPartyId=MS HTTP/1.1" 200 0
"GET /auth/authorisationurl?thirdPartyId=MS HTTP/1.1" 200 211
"OPTIONS /auth/signinup HTTP/1.1" 200 0
"POST /auth/signinup HTTP/1.1" 200 263
"OPTIONS /viewer/ HTTP/1.1" 200 0
Unauthorized: /viewer/
"GET /viewer/ HTTP/1.1" 401 26
"OPTIONS /viewer/ HTTP/1.1" 200 0
Unauthorized: /viewer/
"GET /viewer/ HTTP/1.1" 401 26
"OPTIONS /viewer/ HTTP/1.1" 200 0
Unauthorized: /viewer/
"GET /viewer/ HTTP/1.1" 401 26
"OPTIONS /viewer/ HTTP/1.1" 200 0
Unauthorized: /viewer/
"GET /viewer/ HTTP/1.1" 401 26
"OPTIONS /viewer/ HTTP/1.1" 200 0
Unauthorized: /viewer/
"GET /viewer/ HTTP/1.1" 401 26
"OPTIONS /viewer/ HTTP/1.1" 200 0
Unauthorized: /viewer/
"GET /viewer/ HTTP/1.1" 401 26
r

rp

10/24/2022, 4:13 PM
Ahh no. These aren’t the debug logs generated by supertokens
See the troubleshooting section in the docs
a

AntonyBush

10/24/2022, 4:16 PM
Ok
In the docs it says run python app.py which py file should I mention
r

rp

10/24/2022, 4:36 PM
the one that you use to start your backend server
a

AntonyBush

10/24/2022, 4:41 PM
I tried with manage.py runserver but didn't get the output.
r

rp

10/24/2022, 4:42 PM
Are you calling supertokens.init in your code?
On the backend
a

AntonyBush

10/24/2022, 4:43 PM
init(
    app_info=InputAppInfo(
        app_name="Sup",
        api_domain="http://localhost:8000",
        website_domain="http://localhost:3000",
        api_base_path="/auth",
        website_base_path="/auth"
    ),
    supertokens_config=SupertokensConfig(
        connection_uri='.....
',
        api_key='....'
    ),
    framework='django',
you mean this?
r

rp

10/24/2022, 4:44 PM
Yes
Also, you should probably change ur api key now. Since you made it public here
If no logs r being printed, it means you haven’t set the env var correctly
a

AntonyBush

10/24/2022, 4:45 PM
Okay I'll look into it
I'm getting this now
Session does not exist. Are you sending the session tokens in the request as cookies?
r

rp

10/25/2022, 4:15 PM
Can you show me the request headers for the API call being made from the browser?
I see. Are you using axios on the frontend?
when u make the APi call
a

AntonyBush

10/25/2022, 4:18 PM
yes
r

rp

10/25/2022, 4:18 PM
which version of the frontend SDK are you using?
and which frontend SDK?
can you update to 0.27.0 for supertokens-auth-react and try again?
a

AntonyBush

10/25/2022, 4:20 PM
Ok
now i'm unable to login
it's going for refresh call
r

rp

10/25/2022, 4:24 PM
can you elaborate?
and can i see all the cookies that are being sent?
a

AntonyBush

10/25/2022, 4:25 PM
while login the refresh call is unauthorized
r

rp

10/25/2022, 4:26 PM
what are the cookies that are sent to it?
and also, what are the response headers from the login API?
can you also enable frontend debug logs and show me the output
a

AntonyBush

10/25/2022, 4:27 PM
Oh my bad
I referred a similar thread and you said set the same_cookie param to "none"
I removed this param
now it's working
r

rp

10/25/2022, 4:28 PM
ok nice!
a

AntonyBush

10/25/2022, 4:28 PM
thanks a lot