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

Bug: Detection of Network Errors when refreshing Tokens #192

Closed
phal0r opened this issue Jan 19, 2022 · 0 comments · Fixed by #197
Closed

Bug: Detection of Network Errors when refreshing Tokens #192

phal0r opened this issue Jan 19, 2022 · 0 comments · Fixed by #197
Labels
enhancement New feature or request

Comments

@phal0r
Copy link

phal0r commented Jan 19, 2022

Capacitor version:

Run npx cap doctor:

Any Capacitor 3 version

Library version:

  • 3.0.1

OAuth Provider:

  • Other: Ory Hydra

Your Plugin Configuration

{}

Affected Platform(s):

  • Android

    • Version/API Level: All
  • iOS

    • Version/API Level: All

Current Behavior

Error handling for refreshToken is not en par between iOS and Android, also with the current error codes, it's not possible to distinguish network errors and provider errors.

For iOS: https://github.com/moberwasserlechner/capacitor-oauth2/blob/main/ios/ByteowlsCapacitorOauth2/Source/ByteowlsCapacitorOauth2.swift#L148

Codes:

  • .cancelled, .accessDenied -> do they make sense here? Also the returned error code from the plugin is ERR_USER_CANCELED, which is imho not applicable, because there is no user interaction while refreshing
  • .stateNotEqual -> a refresh request does not include state, so this code can never occur here
  • all other errors return ERR_AUTHORIZATION_FAILED and as an app developer it is impossible to detect, if it was due to a network error or a provider error

Expected Behavior

It should be possible to detect, what went wrong during token refresh. If the refresh token is expired, the user should be logged out, but in case of network errors, it would be better to show network problem message or something similar and not just log the user out, which leads to a bad user experience on mobile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants