I'm building a FastAPI application with OAuth2 and JWT authentication. I've got two endpoints that create the JWT token. The first is hidden from the OpenAPI page but is used by the page Authorize
button. The second does the same functionality but is available to the users as an API endpoint.
If the user uses the page Authorize
button and successfully gets authenticated, the rest of the API endpoints on the OpenAPI page become accessible.
If the user uses the API get_token
endpoint only, they get a valid JWT token, which can be used with the protected API's, but the OpenAPI page isn't authenticated.
How can I use the token returned by the public get_token
API endpoint to authenticate the OpenAPI page as if the user went through OpenAPI provided Authorize
functionality?