Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refreshing Azure OAuth2 access_tokens for long user sessions #995

Open
fcestari opened this issue May 15, 2024 · 0 comments
Open

Refreshing Azure OAuth2 access_tokens for long user sessions #995

fcestari opened this issue May 15, 2024 · 0 comments

Comments

@fcestari
Copy link

Is your feature request related to a problem? Please describe.
I'm facing an issue with handling OAuth2 tokens with the Azure azure-ad provider. When a user session extends beyond the lifetime of the access_token, the token expires, and it seems there is no built-in method in the library to handle the refresh of these tokens. This interrupts the user session and requires manual intervention to reauthorize.

Describe the solution you'd like
Automatic handling of OAuth2 access tokens.
For example, Azure has python SDKs like azure-identity and msal that automatically handle token cache and token refresh.

Describe alternatives you've considered
I have created an additional class that inherits from base class AzureADOAuthProvider and overrode the methods get_token and get_user_info, as in my scenario I need to use on-behalf-of flow. I've utilized the azure-identitycredential classes for these methods, AuthorizationCodeCredential and OnBehalfOfCredential respectively, and tried to pass them and store in the user session to be used later on for external API requests towards Azure, but no good.

Additional context
I'd very much appreciate if you can give directions on how to use the user session cl.user_session and the cl.oauth2_callback to always have refreshed access tokens towards Azure services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant