capacitor-community / generic-oauth2

Generic Capacitor OAuth 2 client plugin. Stop the war in Ukraine!
MIT License
223 stars 106 forks source link

Bug: Detection of Network Errors when refreshing Tokens #192

Closed phal0r closed 1 year ago

phal0r commented 2 years ago

Capacitor version:

Run npx cap doctor:

Any Capacitor 3 version

Library version:

OAuth Provider:

Your Plugin Configuration

{}

Affected Platform(s):

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:

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.