https://supertokens.com/ logo
#support-questions
Title
# support-questions
λ

Λ C Ξ L X R D

05/15/2022, 6:15 PM
how can I add more than one website domain?
r

rp

05/15/2022, 6:26 PM
Hey! Depends on your use case. Can you please elaborate on it?
λ

Λ C Ξ L X R D

05/15/2022, 6:28 PM
We are hosting our website localy for testing and a demo version on heroku and we had the website domain in the init function as localhost:8000 which causes problems for heroku where the frontend sdk doesnt work properly
r

rp

05/15/2022, 6:30 PM
hmm. Consider using env vars? For local dev, you can set it to localhost:8000, and for heroku, you can set it to the site that heroku serves?
λ

Λ C Ξ L X R D

05/15/2022, 6:35 PM
I considered that as an option yea I was just wondering if it was possible because some of our team access the site through 127.0.0.1:8000 and that causes them the same issue
r

rp

05/15/2022, 6:39 PM
What issue are you seeing in this case? That sessions don’t work?
λ

Λ C Ξ L X R D

05/15/2022, 6:41 PM
i just tried refreshing the token on localhost:8000 and i get this 404 error
r

rp

05/15/2022, 6:42 PM
Can you enable backend debug logging and show me the output when you do that API call?
λ

Λ C Ξ L X R D

05/15/2022, 6:44 PM
Copy code
com.supertokens {"t": "2022-05-15T18:43:51.565Z", "sdkVer": "0.7.0", "message": "middleware: Started", "file": "supertokens.py:339"}
com.supertokens {"t": "2022-05-15T18:43:51.566Z", "sdkVer": "0.7.0", "message": "middleware: Not handling because request path did not start with config path. Request path: /login", "file": "supertokens.py:347"}
com.supertokens {"t": "2022-05-15T18:43:51.567Z", "sdkVer": "0.7.0", "message": "getSession: Started", "file": "recipe\\session\\recipe_implementation.py:134"}
com.supertokens {"t": "2022-05-15T18:43:51.568Z", "sdkVer": "0.7.0", "message": "getSession: rid in header: False", "file": "recipe\\session\\recipe_implementation.py:138"}
com.supertokens {"t": "2022-05-15T18:43:51.568Z", "sdkVer": "0.7.0", "message": "getSession: request method: GET", "file": "recipe\\session\\recipe_implementation.py:139"}
com.supertokens {"t": "2022-05-15T18:43:51.569Z", "sdkVer": "0.7.0", "message": "getSession: Returning try refresh token because access token from cookies is undefined", "file": "recipe\\session\\recipe_implementation.py:152"}
need to refresh session
INFO:     127.0.0.1:33735 - "GET /login HTTP/1.1" 200 OK
com.supertokens {"t": "2022-05-15T18:43:52.017Z", "sdkVer": "0.7.0", "message": "middleware: Started", "file": "supertokens.py:339"}
com.supertokens {"t": "2022-05-15T18:43:52.018Z", "sdkVer": "0.7.0", "message": "middleware: Not handling because request path did not start with config path. Request path: /static/styles/style.css", "file": "supertokens.py:347"}
INFO:     127.0.0.1:33735 - "GET /styles/style.css HTTP/1.1" 200 OK
com.supertokens {"t": "2022-05-15T18:43:52.805Z", "sdkVer": "0.7.0", "message": "middleware: Started", "file": "supertokens.py:339"}
com.supertokens {"t": "2022-05-15T18:43:52.805Z", "sdkVer": "0.7.0", "message": "middleware: Not handling because request path did not start with config path. Request path: /static/images/wave.png", "file": "supertokens.py:347"}
Copy code
INFO:     127.0.0.1:33735 - "GET /images/wave.png HTTP/1.1" 200 OK
com.supertokens {"t": "2022-05-15T18:43:52.861Z", "sdkVer": "0.7.0", "message": "middleware: Started", "file": "supertokens.py:339"}
com.supertokens {"t": "2022-05-15T18:43:52.861Z", "sdkVer": "0.7.0", "message": "middleware: Not handling because request path did not start with config path. Request path: /favicon.ico", "file": "supertokens.py:347"}
INFO:     127.0.0.1:33735 - "GET /favicon.ico HTTP/1.1" 404 Not Found
com.supertokens {"t": "2022-05-15T18:43:53.380Z", "sdkVer": "0.7.0", "message": "middleware: Started", "file": "supertokens.py:339"}
com.supertokens {"t": "2022-05-15T18:43:53.380Z", "sdkVer": "0.7.0", "message": "middleware: Not handling because request path did not start with config path. Request path: /auth/session/refresh", "file": "supertokens.py:347"}
INFO:     127.0.0.1:33735 - "POST /auth/session/refresh HTTP/1.1" 404 Not Found
it sometimes works and sometimes doesnt
r

rp

05/15/2022, 6:46 PM
And what are the logs when you start the backend process?
λ

Λ C Ξ L X R D

05/15/2022, 6:46 PM
what do you mean?
r

rp

05/15/2022, 6:46 PM
So the above logs are when you call an API
there must be logs when the backend process restarts too
λ

Λ C Ξ L X R D

05/15/2022, 6:47 PM
yes the refresh token one
i dont understand which backend process you are referring to
r

rp

05/15/2022, 6:48 PM
Python process
When u start the python backend. It must show logs.
λ

Λ C Ξ L X R D

05/15/2022, 6:49 PM
yes those
r

rp

05/15/2022, 6:49 PM
Essentially there will be a few logs when you initialise supertokens in python as well. What’s the output of those?
λ

Λ C Ξ L X R D

05/15/2022, 6:49 PM
Copy code
com.supertokens {"t": "2022-05-15T18:48:56.613Z", "sdkVer": "0.7.0", "message": "Started SuperTokens with debug logging (supertokens.init called)", "file": "supertokens.py:178"}
com.supertokens {"t": "2022-05-15T18:48:56.614Z", "sdkVer": "0.7.0", "message": "app_info: {
    "api_base_path": "/api",
    "api_domain": "http://localhost:8000",
    "api_gateway_path": "",
    "app_name": "E-learning Websecurity",
    "framework": "fastapi",
    "mode": "asgi",
    "website_base_path": "/auth",
    "website_domain": "http://localhost:8000"
}", "file": "supertokens.py:179"}
com.supertokens {"t": "2022-05-15T18:48:56.615Z", "sdkVer": "0.7.0", "message": "framework: fastapi", "file": "supertokens.py:180"}
com.supertokens {"t": "2022-05-15T18:48:56.615Z", "sdkVer": "0.7.0", "message": "session init: anti_csrf: NONE", "file": "recipe\\session\\recipe.py:74"}
com.supertokens {"t": "2022-05-15T18:48:56.616Z", "sdkVer": "0.7.0", "message": "session init: cookie_domain: None", "file": "recipe\\session\\recipe.py:78"}
com.supertokens {"t": "2022-05-15T18:48:56.617Z", "sdkVer": "0.7.0", "message": "session init: cookie_same_site: lax", "file": "recipe\\session\\recipe.py:79"}
com.supertokens {"t": "2022-05-15T18:48:56.617Z", "sdkVer": "0.7.0", "message": "session init: cookie_secure: False", "file": "recipe\\session\\recipe.py:80"}
com.supertokens {"t": "2022-05-15T18:48:56.618Z", "sdkVer": "0.7.0", "message": "session init: refresh_token_path: /api/session/refresh ", "file": "recipe\\session\\recipe.py:81"}
com.supertokens {"t": "2022-05-15T18:48:56.618Z", "sdkVer": "0.7.0", "message": "session init: session_expired_status_code: 401", "file": "recipe\\session\\recipe.py:82"}
r

rp

05/15/2022, 6:50 PM
Ok so the issue is that you have given api_base_path on the backend as /api
But on the frontend you have not set the same
So it is querying /auth/session/refresh instead of /api/session/refresh
λ

Λ C Ξ L X R D

05/15/2022, 6:51 PM
Okayy got it
thank you once again 🙏 ❤️
3 Views