diff --git a/flutter_appauth/CHANGELOG.md b/flutter_appauth/CHANGELOG.md index 6ba5600..34887b6 100644 --- a/flutter_appauth/CHANGELOG.md +++ b/flutter_appauth/CHANGELOG.md @@ -3,6 +3,7 @@ * **Breaking change** all methods have now been made to return non-nullable types * [Android] updated plugin to specify `Theme.AppCompat.Translucent.NoTitleBar` as the theme for the `RedirectUriReceiverActivity` from the AppAuth Android SDK. This is to fix a crash raised with issues [#362](https://github.com/MaikuB/flutter_appauth/issues/362) and [#515](https://github.com/MaikuB/flutter_appauth/issues/515) * [iOS][macOS] bumped AppAuth iOS dependency to 1.7.5 +* Added `FlutterAppAuthOAuthError` class that contains string constants representing OAuth 2.0 error codes defined by the [specification](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2). * Updated API docs with more details * Updated readme with more details on essential knowledge and links to OAuth 2.0 specifications diff --git a/flutter_appauth_platform_interface/CHANGELOG.md b/flutter_appauth_platform_interface/CHANGELOG.md index 3dc5712..9150b3d 100644 --- a/flutter_appauth_platform_interface/CHANGELOG.md +++ b/flutter_appauth_platform_interface/CHANGELOG.md @@ -2,6 +2,7 @@ * **Breaking change** all methods have now been made to return non-nullable types * Updated API docs with more details +* Added `FlutterAppAuthOAuthError` class that contains string constants representing OAuth 2.0 error codes defined by the [specification](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2). ## [7.0.0-dev.2] diff --git a/flutter_appauth_platform_interface/lib/src/errors.dart b/flutter_appauth_platform_interface/lib/src/errors.dart index e6b9332..7d64599 100644 --- a/flutter_appauth_platform_interface/lib/src/errors.dart +++ b/flutter_appauth_platform_interface/lib/src/errors.dart @@ -37,6 +37,13 @@ class FlutterAppAuthPlatformErrorDetails { /// For 400 errors from the authorization server, this is corresponds to the /// `error` parameter as defined in the OAuth 2.0 framework [here](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2). /// Otherwise a short error describing what happened. + /// + /// The [FlutterAppAuthOAuthError] class contains string constants for + /// the standard error codes that could used by applications to determine the + /// nature of the error. + /// + /// Note that authorization servers may return custom error codes that are not + /// defined in the OAuth 2.0 framework. final String? error; /// Short, human readable error description. @@ -133,3 +140,17 @@ class FlutterAppAuthPlatformException extends PlatformException { /// Details of the error from the underlying platform's AppAuth SDK. final FlutterAppAuthPlatformErrorDetails platformErrorDetails; } + +/// Represents OAuth error codes that can be returned by the authorization +/// server. +/// +/// These are the standard error codes defined in the OAuth 2.0 framework +/// [here](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2). +class FlutterAppAuthOAuthError { + static const String invalidRequest = 'invalid_request'; + static const String invalidClient = 'invalid_client'; + static const String invalidGrant = 'invalid_grant'; + static const String unauthorizedClient = 'unauthorized_client'; + static const String unsupportedGrantType = 'unsupported_grant_type'; + static const String invalidScope = 'invalid_scope'; +}