routes
verify_session
@auth_router.post('/verify-session')
async def verify_session(req: Request,
credentials: HTTPAuthorizationCredentials = Depends(
HTTPBearer(auto_error=False)))
Helper to verify whether the user has a valid session JWT in the request they made. The function should be applied
as a dependency to any fast api routes that require session management
Arguments:
credentials
: the extracted credentials from the request
handle_refresh_token
@auth_router.post('/refresh-token')
async def handle_refresh_token(
response: Response,
dara_refresh_token: Union[str, None] = Cookie(default=None),
credentials: HTTPAuthorizationCredentials = Depends(HTTPBearer()))
Given a refresh token, issues a new session token and refresh token cookie.
Arguments:
response
: FastAPI response objectdara_refresh_token
: refresh token cookiesettings
: env settings object