-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Description
I had an unhandled exception when calling PersistentAuthHelper.GetToken(string id, string resource)
to log into an Azure subscription which I hadn't accessed in a very long time. Unfortunately I didn't document the details (or locate and back up the token cache) before trying a workaround, but the gist was that BaseAuthHelper.GetTokenInternal
went into the case
if (cacheInfo.ExpiresOn <= DateTimeOffset.UtcNow) |
which called
return await GetAuthorizationResultByRefreshToken(tokenCache, cacheInfo); |
and that threw an exception on receiving an HTTP 400 response because the refresh token was too old.
A workaround is to change
if (ex.Message.IndexOf(" is expired") < 0) |
to
if (ex.Message.IndexOf(" is expired") < 0 && ex.Message.IndexOf(" has expired") < 0)
but I suspect that a better solution would be to rework the logic of GetTokenInternal
so that it treats a cache entry older than some cutoff (90 days?) as non-existent.
Metadata
Metadata
Assignees
Labels
No labels