question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handling of failed federated token refresh due to network error

See original GitHub issue

Describe the bug

If federated token refresh fails due to a network error, auth resets requiring the user to manually sign in again. Since token refreshing hasn’t failed due to rejection by the identity provider the refresh token may still be valid and can still be used once internet access is restored.

I’m using Auth0 as my federated auth provider.

To Reproduce Steps to reproduce the behavior:

I perform the following in a React Native app running in the iOS simulator.

  1. Set token expiry to 60 seconds in Auth0 console
  2. Authenticate in the app
  3. Disconnect from the internet (turn off wifi on mac running simulator)
  4. Wait 60+ seconds
  5. Open the app. Token refresh will be attempted but fail due to lack of internet access.
  6. Reconnect internet

From this point on the API client calls reject with "Missing Authentication Token". In the scenario described here token refreshing has failed because of a network problem, not because my identity provider (auth0) as rejected the refresh request. I feel this type of error should be treated differently from a “identity provided responded and refused to refresh the token” type error.

Expected behavior

If token refreshing is not possible because of a network error the API client shouldn’t clear/reset the current federated sign in. This is particularly important in React Native as network access could be intermittent.

The documentation for handling federated auth needs a lot of work and should better explain how the API client behaves if token refreshing has failed.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
willdadycommented, Dec 21, 2018

@powerful23 once the app launches my initial components triggers various API requests to API Gateway using the API client provided by Amplify. I don’t call Auth.currentCredentials(). I am working on the assumption that Amplify just works and knows how to deal with intermittent network access.

As described above I think there needs to be a better way of dealing with the case where the refreshHandlers fail because of lack of internet access.

1reaction
willdadycommented, May 27, 2019

@usmansbk No it’s an ongoing issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Refresh Token call fails repeatedly on an unstable network ...
Devices that face temporary network loss are unable to use the refresh token. Error "Refresh token Invalid" is thrown repeatedly for devices ...
Read more >
Using the refresh token - Amazon Cognito - AWS Documentation
If the refresh token is expired, your app user must re-authenticate by signing in again to your user pool. If the minimum for...
Read more >
Failure to generate access token using refresh token for O365 ...
Yes, refresh tokens will become invalid after a password change. Only non-password based tokens will stay valid ...
Read more >
Azure AD Sign-in Error 50085 - ManageEngine
Error 50085 - Refresh token needs social IDP login. Have user try signing-in again with username and password. About Azure Activity sign-in activity...
Read more >
Dreaded Failed to refresh access token for service error
The Office 365 Users connection is giving me the subject error. It also states that the Refresh Token has expired due to inactivity....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found