auth0 / Auth0.swift

Auth0 SDK for Apple platforms
https://auth0.github.io/Auth0.swift
MIT License
345 stars 225 forks source link

Missing AuthenticationError helper for Revoked tokens #819

Closed lordzsolt closed 9 months ago

lordzsolt commented 9 months ago

Checklist

Description

When a refresh token is invalidated remotely, when attempting to obtain a new access token using this refresh token, Auth0 will reply with:

{
    "error": "invalid_grant",
    "error_description": "Unknown or invalid refresh token."
}

This case does not exist in Auth0.swift, but exists in Auth0.android: https://github.com/auth0/Auth0.Android/blob/148df396c5706579b99bb7a1d26e00ea65a93753/auth0/src/main/java/com/auth0/android/authentication/AuthenticationException.kt#L204C16-L204C37


I would expect AuthenticationError to contain isInvalidRefreshToken same as Auth0.Android.

Reproduction

  1. Log in with a user
  2. Find the user in the Auth0 management: UserManagement -> Users -> YOUR_USER
  3. Devices
  4. Delete your device, revoking the refresh token
  5. Attempt to get a new access token using CredentialsManager.credentials (calls oauth/token)
  6. Notice the returned error

Additional context

No response

Auth0.swift version

2.5.0

Platform

iOS

Platform version(s)

17.0

Xcode version

15.1

Package manager

Cocoapods