-
Notifications
You must be signed in to change notification settings - Fork 208
import_refresh_token() for RT migration #191
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
Conversation
|
There is a similar feature in MSAL.NET that @trwalke implemented - see https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/wiki/Adal-to-Msal#adalnet-v2x-migration-to-msalnet-v3x |
|
A comparison between 2 flavors of API:
|
|
I believe the idea with try:
# if this works, migration is not needed or it already happened
acquire_token_silent
except UIRequiredException:
# migration path ... can be removed after some time
rt = get_legacy_refresh_token
acquire_token_by_refersh_token
except UIRequiredException:
# no RT available, get a new one
acquire_token_by_XWhat are your thoughts on full scenario using CC @jmprieur who designed the API originally |
|
There has been some offline discussion since sending out this PR. We will end up choosing one solution soon. But here in this comment, for the sake of answering @bgavrilMS 's question above, and leaving a trace here for future reference:
|
import_refresh_token() for RT migration
import_refresh_token() for RT migration|
Put my review comments on the other PR 193 to avoid duplication of comments |
And the way this is done in Java and .NET you don't need to get the result and do anything with it nor do you need to call acquire_token_silent if you needed to use the result right away. acquire_token_by_refresh_token() gets my vote |
This is true. Regardless of whether we implement
Yep. #193 implements |
This PR proposes an experimental API for migrating refresh token (RT) from other source (typically ADAL Python, but not necessarily only ADAL Python) to MSAL Python.
TL;DR: This PR proposes an
import_refresh_token(old_rt_string, scope_list)as first-class citizen (i.e. not hiding from main API). As hinted by its name, its successful return value contains no RT, not even AT, not currently return an ID token (this one is TBD).So that there will be no way to (ab)use such migration API alone as a normal flow. The programming model would be to complete the RT migration upfront, and then come back to the normal MSAL coding model.
Reviewers can focus on its usage pattern (highlighted at the bottom of this page), rather than its actual implementation.
Background:
acquire_token_by_refresh_token(...).Many MSALs do not provide an
acquire_token_by_refresh_token(rt, scope, ...)API. Instead, MSALs provide a higher level APIacquire_token_silent(scope, ...)which uses RT from internal cache. For example, MSAL .Net only providesAcquireTokenByRefreshToken(...)in an indirect way:But, even so, an
AcquireTokenByRefreshToken()is arguably still provided and documented, and it can be used to acquire AT.MSAL Java provides
AcquireTokenByRefreshToken(...)out-of-the-box. It returns no RT, either, but it returns AT, etc..