简体   繁体   中英

How can I access the /docs or custom routes end point while using fastapi as backend for supertokens?

I am using supertokens to build an authentication system and using fastApi as backend but while using their prebuild UI and already setup backend code in python, I am not able to access the 127.0.0.0:3000/docs endpoint. It is showing only a blank page. Also, the custom routes that I have built in my API are not working and accessible.

Here is the code that I have written


@app.get("/sessioninfo")
async def secure_api(s: SessionContainer = Depends(verify_session())):
    return {
        "sessionHandle": s.get_handle(),
        "userId": s.get_user_id(),
        "accessTokenPayload": s.get_access_token_payload(),
    }

Here is the app_info part of init function in supertokens

app_info = InputAppInfo(
    app_name="demoApp",
    api_domain="http://localhost:3001",
    website_domain="http://localhost:3000",
)

After hitting the API with port 3000 and endpoint /sessioninfo I am getting blankpage localhost:3000/session_info

And for localhost:3001/session_info I am getting an internal server error. localhost:3001/session_info

localhost:3000/session_info won't respond with session info because it's being handled by the front end.

But localhost:3001/session_info should work. Can you check the trace and share more info about the Internal server error that you're facing? Also, can you share your python version and maybe a dump of pip freeze > requirements.txt ?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM