Does anyone know why axios goes into an infinite l...
# support-questions-legacy
m
Does anyone know why axios goes into an infinite loop here when the request fails?
r
Hey @Michael Brant
Is it querying the refresh API and that’s returning a 200?
m
it looks like refresh is returning 200
r
Hmm. Can I see the response headers for the refresh API call?
And also if you enable the frontend debug logs, can I see the output of that when you make the API call?
m
* Response headers of refresh API call: *
Copy code
HTTP/1.1 200 OK
Date: Fri, 24 Jun 2022 18:29:23 GMT
Server: WSGIServer/0.2 CPython/3.9.13
Content-Type: application/json; charset=utf-8
front-token: eyJhdGUiOjE2NTYwOTg5NjM2OTMsInVpZCI6ImQ0NWJjZjcxLWE1MTMtNDYxNS05ZjBlLTQ0MmViYTc5YTcwYiIsInVwIjp7fX0=
Access-Control-Expose-Headers: front-token,id-refresh-token
id-refresh-token: 28bd4f41-dd9e-44cf-8fd2-6e05964bcc92;1664735363692
X-Frame-Options: DENY
Content-Length: 2
Vary: Cookie, Origin
X-Content-Type-Options: nosniff
Referrer-Policy: same-origin
Cross-Origin-Opener-Policy: same-origin
Access-Control-Allow-Credentials: true
Access-Control-Allow-Origin: http://localhost:3000
Set-Cookie:  sAccessToken="eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsInZlcnNpb24iOiIyIn0%3D.eyJzZXNzaW9uSGFuZGxlIjoiODBhZDRiNjItMTQwNC00OWE2LTgzMWYtZTA1YzFjZGI1NmE3IiwidXNlcklkIjoiZDQ1YmNmNzEtYTUxMy00NjE1LTlmMGUtNDQyZWJhNzlhNzBiIiwicmVmcmVzaFRva2VuSGFzaDEiOiI2Mzg5MGVjNTcyMjRkOTA1OTkyZWZkYjBmNWY5M2FhNjY2NThjNGE1OGQ2OGNhMWI5ZWJjNjA5NTQ4ZGM5ODAxIiwicGFyZW50UmVmcmVzaFRva2VuSGFzaDEiOiI1OGIxNjhmNzIxMzQ2MzRjNDM2ODg5N2YxNjgyMmUxYjc5MmY5MmE1N2NmODI3NWQ0YTI4MTFhM2U3ZTU5MDk3IiwidXNlckRhdGEiOnt9LCJleHBpcnlUaW1lIjoxNjU2MDk4OTYzNjkzLCJ0aW1lQ3JlYXRlZCI6MTY1NjA5NTM2MzY5MywibG1ydCI6MTY1NjA5NTM2MzY5M30%3D.T1/67p5dUA7SGGoKyeu413%2BXTBJJqe7i%2B7cHMW0RK4SWbtUAWxM/5ZsTG0uHU5PAh7iY8LCvnWhgc790BwOMFhX20znRsIwCkgqGZcdPeVpd8SNbuwDtSaWpGdt5oUrSS5Z3lnCI7upoiMkfAptRSxojXwRKQwdPuBvYp18USutVW5xp1XQL0mUBpvg48qyB5p/eUF3CKfx76hwnVWeyAh%2BYF0stQFPmWj1KkkJtOi%2Bf/n061jqJhqkyAK4t/ktA8eAQRx40R/vbPq8dXiURc9SC4JgZDkkCM313StsDfOdp66yCrW%2B6bi%2Bn4HCLPYy77is/LEMXySDIhHfZ1Rz25g%3D%3D"; expires=Friday, June 24, 2022 19:29:24; HttpOnly; Path=/; SameSite=lax
Set-Cookie:  sRefreshToken="4PcyV0TSJNBNSgtsHrzQ6tbIp%2BdSIJYFiCgjDcBabOhr6UHvYyvM45Co7sGCLHLv3zueWRVC0P4C3liLbbCExzqCZDexe%2BqTtTSuk2otceUd9vLLFUdnSgTE6GpXF05fCSXRIIRyQksB74bNlyl2n5v0cO11eB/biOTR0m6xnlQo1hjI5GjXLLRcv4vIdeaG38eHc6tNammS0DC7ubFYIHK5xfDgVabF3UJpyC3laHzIr9o9lEamXha4w9HJX/07qGkTNLxQGIOT6ZxrF4uzDDnpbVpD9fxQ4dFg7%2BlfgRq1Oj2tGDSnIiNolBSQ1NKGKfZ/J%2BnDUAOUjiUc/Z0Env0LWRc9GE6Zqk6psLDTZAs92CEedvX/eLppgld239NbdZEjBIsxLoT93WGG.90fef3b74f8c818e03885c944309b8fa345909c16b71a7d7496479a0eb79ceb2.V2"; expires=Sunday, October 02, 2022 18:29:24; HttpOnly; Path=/auth/session/refresh; SameSite=lax
Set-Cookie:  sIdRefreshToken=28bd4f41-dd9e-44cf-8fd2-6e05964bcc92; expires=Sunday, October 02, 2022 18:29:24; HttpOnly; Path=/; SameSite=lax
r
and the request headers were?
m
I'm not sure how to enable frontend debug logs. Is that from reactjs or from google chrome developer tools? I do see the cookies being sent in the request headers for the API call, though.
can you show me the log output?
m
Do you need more?
r
can you show me the backend logs as well? for when it calls the /api/v1/private API?
the link above shows you how to enable backend logs as well
m
sure, also, should refresh be returning something here?
r
refresh seems fine
m
Here are some lines from the backend logs:
Copy code
2022-06-24 18:43:52,155 DEBUG [com.supertokens:357] supertokens 19616 139831413827136 {"t": "2022-06-24T18:43:52.156Z", "sdkVer": "0.8.4", "message": "middleware: Started", "file": "supertokens.py:357"}
com.supertokens {"t": "2022-06-24T18:43:52.156Z", "sdkVer": "0.8.4", "message": "middleware: Not handling because request path did not start with config path. Request path: /api/v1/private", "file": "supertokens.py:365"}

2022-06-24 18:43:52,156 DEBUG [com.supertokens:365] supertokens 19616 139831413827136 {"t": "2022-06-24T18:43:52.156Z", "sdkVer": "0.8.4", "message": "middleware: Not handling because request path did not start with config path. Request path: /api/v1/private", "file": "supertokens.py:365"}
2022-06-24 18:43:52,157 WARNING [django.request:225] log 19616 139831552501312 Unauthorized: /api/v1/private
2022-06-24 18:43:52,157 WARNING [django.server:179] basehttp 19616 139831552501312 "GET /api/v1/private HTTP/1.1" 401 99
com.supertokens {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: Started", "file": "supertokens.py:357"}

2022-06-24 18:43:52,247 DEBUG [com.supertokens:357] supertokens 19616 139831413827136 {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: Started", "file": "supertokens.py:357"}
com.supertokens {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: requestRID is: session", "file": "supertokens.py:370"}

2022-06-24 18:43:52,247 DEBUG [com.supertokens:370] supertokens 19616 139831413827136 {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: requestRID is: session", "file": "supertokens.py:370"}
com.supertokens {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: Checking recipe ID for match: session", "file": "supertokens.py:379"}

2022-06-24 18:43:52,247 DEBUG [com.supertokens:379] supertokens 19616 139831413827136 {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: Checking recipe ID for match: session", "file": "supertokens.py:379"}
com.supertokens {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: Matched with recipe ID: session", "file": "supertokens.py:395"}

2022-06-24 18:43:52,247 DEBUG [com.supertokens:395] supertokens 19616 139831413827136 {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: Matched with recipe ID: session", "file": "supertokens.py:395"}
com.supertokens {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: Request being handled by recipe. ID is: /session/refresh", "file": "supertokens.py:401"}

2022-06-24 18:43:52,247 DEBUG [com.supertokens:401] supertokens 19616 139831413827136 {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "middleware: Request being handled by recipe. ID is: /session/refresh", "file": "supertokens.py:401"}
com.supertokens {"t": "2022-06-24T18:43:52.247Z", "sdkVer": "0.8.4", "message": "refreshSession: Started", "file": "recipe/session/recipe_implementation.py:180"}
r
this is strange:
Copy code
2022-06-24 18:43:52,157 WARNING [django.request:225] log 19616 139831552501312 Unauthorized: /api/v1/private
Are you using some other session verificatino method as well?
maybe the one provided by django??
cause that seems to be returning 401
m
yeah, I'm using Django Rest Framework's authentication. I guess that's causing the issue?
r
yeaa.. u should remove that
m
ok yeah that's probably it. I was trying to add it to an existing django project. I'll start fresh from a new django project. Thanks for the help!!
3 Views