You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can you please provide a complete walk-through how to implement the example in an existing code?
I received the client_id, base_authorization_server_uri, issuer (must be the same as base_authorization_server_uri in my case, this is what I was told ), and I have tried using the code as shown in the readme with these values, but all I get is an empty "Available authorizations" dialog and "Not authenticated" error message in the Swagger UI.
So, what else should be added to a code in main.py like
importdatetime, os, random, timefrompathlibimportPathfromtypingimportUnion, OptionalfromfastapiimportFastAPI, Depends, File, UploadFile, statusfromfastapi.responsesimportFileResponsefromcollections.abcimportCallablefromfastapi_oidcimportIDToken, get_authOIDC_config= {
"client_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"base_authorization_server_uri": "https://url",
"issuer": "https://url",
"signature_cache_ttl": 3600,
}
swagger_ui_init_oauth= {
"clientId": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"appName": "name",
"usePkceWithAuthorizationCodeGrant": "true",
###"clientSecret": "secret", ### Told not to use it if I use PKCE"oauth2RedirectUrl": "https://redirURL",
"scopeSeparator": " ",
"scopes": "scopes...",
}
authenticate_user: Callable=get_auth(**OIDC_config)
app=FastAPI(swagger_ui_init_oauth=swagger_ui_init_oauth)
@app.post("/highlight_file/", tags=['highlight_file'])asyncdefhighlight_file(file: UploadFile=File(...), id_token: IDToken=Depends(authenticate_user)):
print(f'ID Token: {id_token}')
returnawaithighlight_file_function(file)
asyncdefhighlight_file_function(file):
# process file code
The text was updated successfully, but these errors were encountered:
Can you please provide a complete walk-through how to implement the example in an existing code?
I received the client_id, base_authorization_server_uri, issuer (must be the same as base_authorization_server_uri in my case, this is what I was told ), and I have tried using the code as shown in the readme with these values, but all I get is an empty "Available authorizations" dialog and "Not authenticated" error message in the Swagger UI.
So, what else should be added to a code in
main.py
likeThe text was updated successfully, but these errors were encountered: