Skip to content

Commit

Permalink
added FlutterAppAuthOAuthError to hold standard error codes that apps…
Browse files Browse the repository at this point in the history
… can reference (#523)
  • Loading branch information
MaikuB authored Aug 10, 2024
1 parent 192c79b commit 10d578f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions flutter_appauth/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions flutter_appauth_platform_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
21 changes: 21 additions & 0 deletions flutter_appauth_platform_interface/lib/src/errors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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';
}

0 comments on commit 10d578f

Please sign in to comment.