Open anders-kiaer opened 1 year ago
Problem still seems to persist. A workaround might be to change line 138 here https://github.com/equinor/webviz/blob/48f51276898d8edb09363ffa20a58ddd2d1dd44a/backend/src/fastapi_app/auth/auth_helper.py#L138 to:
id_token_claims = request_with_session.session.get("logged_in_user_id_token_claims") or {}
For some reason the .get()
function on line 138 returns None
, so the default value {}
is not used.
The error seems a bit flaky (but is consistent when it first starts appearing). It was working for some hours on my laptop, and now suddenly this error started appearing again without changes to backend dependencies / auth-helper.
Deleting cookie on localhost:8080
resolved it for me.
Further investigation strongly indicates that the cause of this error is changes introduced in MSAL 1.21
Apparently we're no longer able to get id_token_claims
from acquire_token_silent()
by passing our client id as scope.
Have done som initial investigations and experiments to try and resolve this without success, so for now let's simply lock the MSAL version to 1.20 (see PR #109)
We should refactor our authentication code to not rely on the id_token_claims
, but rather get the user information and expiry time in another way. We can probably get the user information (through the id_token
or the id_token_claims
) during the initial processing of the auth callback. The expiry time we should be able to deduce from the access tokens and just keep track of it ourselves.