From 8c10e0419c02e2524e0d397aec0c4b7c57b1f15d Mon Sep 17 00:00:00 2001 From: Michael Bui <25263378+MaikuB@users.noreply.github.com> Date: Fri, 9 Aug 2024 21:02:59 +1000 Subject: [PATCH] extract error_uri via AppAuth iOS SDK --- flutter_appauth/CHANGELOG.md | 4 ++++ flutter_appauth/ios/Classes/FlutterAppAuth.m | 11 +++++++---- flutter_appauth/pubspec.yaml | 4 ++-- flutter_appauth_platform_interface/CHANGELOG.md | 4 ++++ .../lib/src/errors.dart | 2 -- flutter_appauth_platform_interface/pubspec.yaml | 2 +- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/flutter_appauth/CHANGELOG.md b/flutter_appauth/CHANGELOG.md index 2ed3e54..0c2e3e4 100644 --- a/flutter_appauth/CHANGELOG.md +++ b/flutter_appauth/CHANGELOG.md @@ -1,3 +1,7 @@ +# 7.0.0-dev.2 + +* The `errorUri` property of the `FlutterAppAuthPlatformErrorDetails` class will now be populated on iOS/maCOS if available + # 7.0.0-dev.1 * **Breaking change** Bumped minimum Flutter and Dart SDK constraints to 3.13.0 and 3.1.0 respectively diff --git a/flutter_appauth/ios/Classes/FlutterAppAuth.m b/flutter_appauth/ios/Classes/FlutterAppAuth.m index e5c478a..921ffbd 100644 --- a/flutter_appauth/ios/Classes/FlutterAppAuth.m +++ b/flutter_appauth/ios/Classes/FlutterAppAuth.m @@ -46,11 +46,14 @@ + (void)finishWithError:(NSString *)errorCode message:(NSString *)message result NSDictionary *authErrorMap = [authError isKindOfClass:[NSDictionary class]] ? authError : nil; if (authErrorMap) { - if ([authErrorMap objectForKey:@"error"]) { - [details setObject:authErrorMap[@"error"] forKey:@"error"]; + if ([authErrorMap objectForKey:OIDOAuthErrorFieldError]) { + [details setObject:authErrorMap[OIDOAuthErrorFieldError] forKey:OIDOAuthErrorFieldError]; } - if ([authErrorMap objectForKey:@"error_description"]) { - [details setObject:authErrorMap[@"error_description"] forKey:@"error_description"]; + if ([authErrorMap objectForKey:OIDOAuthErrorFieldErrorDescription]) { + [details setObject:authErrorMap[OIDOAuthErrorFieldErrorDescription] forKey:OIDOAuthErrorFieldErrorDescription]; + } + if ([authErrorMap objectForKey:OIDOAuthErrorFieldErrorURI]) { + [details setObject:authErrorMap[OIDOAuthErrorFieldErrorURI] forKey:OIDOAuthErrorFieldErrorURI]; } } if (error.domain) { diff --git a/flutter_appauth/pubspec.yaml b/flutter_appauth/pubspec.yaml index 5819b70..b955a80 100644 --- a/flutter_appauth/pubspec.yaml +++ b/flutter_appauth/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_appauth description: This plugin provides an abstraction around the Android and iOS AppAuth SDKs so it can be used to communicate with OAuth 2.0 and OpenID Connect providers -version: 7.0.0-dev.1 +version: 7.0.0-dev.2 homepage: https://github.com/MaikuB/flutter_appauth/tree/master/flutter_appauth environment: @@ -10,7 +10,7 @@ environment: dependencies: flutter: sdk: flutter - flutter_appauth_platform_interface: ^7.0.0-dev.1 + flutter_appauth_platform_interface: ^7.0.0-dev.2 flutter: plugin: diff --git a/flutter_appauth_platform_interface/CHANGELOG.md b/flutter_appauth_platform_interface/CHANGELOG.md index 8b51c52..8c40c01 100644 --- a/flutter_appauth_platform_interface/CHANGELOG.md +++ b/flutter_appauth_platform_interface/CHANGELOG.md @@ -1,3 +1,7 @@ +## [7.0.0-dev.2] + +* Updated API docs for `FlutterAppAuthPlatformErrorDetails`'s `errorUri` property as this can now be returned on iOS/macOS + ## [7.0.0-dev.1] * **Breaking change** Bumped minimum Flutter and Dart SDK constraints to 3.13.0 and 3.1.0 respectively diff --git a/flutter_appauth_platform_interface/lib/src/errors.dart b/flutter_appauth_platform_interface/lib/src/errors.dart index d5c6794..e6b9332 100644 --- a/flutter_appauth_platform_interface/lib/src/errors.dart +++ b/flutter_appauth_platform_interface/lib/src/errors.dart @@ -51,8 +51,6 @@ class FlutterAppAuthPlatformErrorDetails { /// /// Corresponds to the `error_uri` parameter defined in the OAuth 2.0 /// framework [here](https://datatracker.ietf.org/doc/html/rfc6749#section-5.2) - /// - /// Only populated on Android. final String? errorUri; /// Error domain from the AppAuth iOS SDK. diff --git a/flutter_appauth_platform_interface/pubspec.yaml b/flutter_appauth_platform_interface/pubspec.yaml index 6e5e360..3908835 100644 --- a/flutter_appauth_platform_interface/pubspec.yaml +++ b/flutter_appauth_platform_interface/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_appauth_platform_interface description: A common platform interface for the flutter_appauth plugin. -version: 7.0.0-dev.1 +version: 7.0.0-dev.2 homepage: https://github.com/MaikuB/flutter_appauth/tree/master/flutter_appauth_platform_interface environment: