Use request again and catch all errors
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
8e4c57029a
commit
96b6ceba70
@ -48,12 +48,12 @@ async def login_keycloak(request: Request):
|
||||
@app.get("/auth")
|
||||
async def auth(request: Request):
|
||||
try:
|
||||
token = await oauth.keycloak.authorize_access_token()
|
||||
except OAuthError as error:
|
||||
return HTMLResponse(f"<h1>{error.error}</h1>")
|
||||
user = await oauth.keycloak.parse_id_token(request, token)
|
||||
request.session["user"] = dict(user)
|
||||
return RedirectResponse(request.url_for("home"))
|
||||
token = await oauth.keycloak.authorize_access_token(request)
|
||||
user = await oauth.keycloak.parse_id_token(request, token)
|
||||
request.session["user"] = dict(user)
|
||||
return RedirectResponse(request.url_for("home"))
|
||||
except Exception as exception:
|
||||
return HTMLResponse(f"<h1>{str(exception)}</h1>")
|
||||
|
||||
|
||||
@app.route("/logout")
|
||||
|
Loading…
Reference in New Issue
Block a user