fastapi-cloudauth icon indicating copy to clipboard operation
fastapi-cloudauth copied to clipboard

How to catch exception or change the Scope not matched message

Open simouel opened this issue 3 years ago • 0 comments

Hi,

Is it possible to catch the "Scope not matched" and display a more accurate message to the user.

`app.include_router( manager.router, prefix="/manager", dependencies=[Depends(auth.scope('cognitogroup1))], ) ... @router.get("/units") def list_units( current_user: AccessUser = Depends(auth.scope(['cognitogroup1'])) ): ret = []; try: print(current_user) except: raise

return "OK"

`

simouel avatar Jul 07 '22 17:07 simouel