[Python] How can I access the /docs or custom routes end point while using fastapi as backend...

Discussão em 'Python' iniciado por Stack, Fevereiro 12, 2025.

  1. Stack

    Stack Membro Participativo

    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

    Continue reading...

Compartilhe esta Página