From 10b637beae124fa8070c8bcaa9e6cfa98d0caec9 Mon Sep 17 00:00:00 2001 From: HenriBeck Date: Mon, 27 Apr 2020 21:43:45 +0200 Subject: [PATCH 1/6] Add identity token --- .../lib/src/authorization_credential.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/sign_in_with_apple/lib/src/authorization_credential.dart b/packages/sign_in_with_apple/lib/src/authorization_credential.dart index bfa2c7a0..0a7900fe 100644 --- a/packages/sign_in_with_apple/lib/src/authorization_credential.dart +++ b/packages/sign_in_with_apple/lib/src/authorization_credential.dart @@ -23,6 +23,7 @@ class AuthorizationCredentialAppleID { @required this.familyName, @required this.email, @required this.authorizationCode, + @required this.identityToken, }) { if (authorizationCode == null) { throw SignInWithAppleAuthorizationException( @@ -79,6 +80,11 @@ class AuthorizationCredentialAppleID { /// This code should be used by your server component to validate the authorization with Apple within 5 minutes upon receiving it. final String authorizationCode; + /// A JSON Web Token (JWT) that securely communicates information about the user to your app. + /// + /// Can be `null`. + final String identityToken; + @override String toString() { return 'AuthorizationAppleID($userIdentifier, $givenName, $familyName, $email, authorizationCode set? ${authorizationCode != null})'; @@ -117,6 +123,7 @@ AuthorizationCredentialAppleID parseAuthorizationCredentialAppleID( familyName: response['familyName'] as String, email: response['email'] as String, authorizationCode: response['authorizationCode'] as String, + identityToken: response['identityToken'] as String, ); } else { throw Exception('Unsupported result type ${response['type']}'); From c1cd2641f4ea06379cbfdd17cb5207248ce03a9b Mon Sep 17 00:00:00 2001 From: HenriBeck Date: Mon, 27 Apr 2020 21:44:16 +0200 Subject: [PATCH 2/6] Add TODO and missing arg --- .../sign_in_with_apple/lib/src/authorization_credential.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/sign_in_with_apple/lib/src/authorization_credential.dart b/packages/sign_in_with_apple/lib/src/authorization_credential.dart index 0a7900fe..acc3b763 100644 --- a/packages/sign_in_with_apple/lib/src/authorization_credential.dart +++ b/packages/sign_in_with_apple/lib/src/authorization_credential.dart @@ -156,5 +156,8 @@ AuthorizationCredentialAppleID parseAuthorizationCredentialAppleIDFromDeeplink( givenName: user != null ? user['name']['firstName'] as String : null, familyName: user != null ? user['name']['lastName'] as String : null, userIdentifier: null, + + /// TODO: Do we get this here + identityToken: null, ); } From 6470e1debf60ea9202da41619620ab9e27e1bc1b Mon Sep 17 00:00:00 2001 From: HenriBeck Date: Mon, 27 Apr 2020 21:54:34 +0200 Subject: [PATCH 3/6] Add identity token --- .../sign_in_with_apple/lib/src/authorization_credential.dart | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/sign_in_with_apple/lib/src/authorization_credential.dart b/packages/sign_in_with_apple/lib/src/authorization_credential.dart index acc3b763..63db6c84 100644 --- a/packages/sign_in_with_apple/lib/src/authorization_credential.dart +++ b/packages/sign_in_with_apple/lib/src/authorization_credential.dart @@ -156,8 +156,6 @@ AuthorizationCredentialAppleID parseAuthorizationCredentialAppleIDFromDeeplink( givenName: user != null ? user['name']['firstName'] as String : null, familyName: user != null ? user['name']['lastName'] as String : null, userIdentifier: null, - - /// TODO: Do we get this here - identityToken: null, + identityToken: deeplink.queryParameters['id_token'], ); } From dc504b2c051ec910c527128bdcb69da6f874125e Mon Sep 17 00:00:00 2001 From: HenriBeck Date: Mon, 27 Apr 2020 21:59:49 +0200 Subject: [PATCH 4/6] Add id token to Android response type --- packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart b/packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart index 9efd828c..73fed327 100644 --- a/packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart +++ b/packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart @@ -197,7 +197,7 @@ class SignInWithApple { .join(' '), // Request `code`, which is also what `ASAuthorizationAppleIDCredential.authorizationCode` contains. // So the same handling can be used for Apple and 3rd party platforms - 'response_type': 'code', + 'response_type': 'code+id_token', 'response_mode': 'form_post', }, ).toString(); From ebf2561527371308c0334ca8a0d7cf87c811c722 Mon Sep 17 00:00:00 2001 From: HenriBeck Date: Mon, 27 Apr 2020 22:56:23 +0200 Subject: [PATCH 5/6] Fix response type --- packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart b/packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart index 73fed327..076974c2 100644 --- a/packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart +++ b/packages/sign_in_with_apple/lib/src/sign_in_with_apple.dart @@ -197,7 +197,7 @@ class SignInWithApple { .join(' '), // Request `code`, which is also what `ASAuthorizationAppleIDCredential.authorizationCode` contains. // So the same handling can be used for Apple and 3rd party platforms - 'response_type': 'code+id_token', + 'response_type': 'code id_token', 'response_mode': 'form_post', }, ).toString(); From 18aaf33392d90956ae2a6a0cb74b31a307cd75ac Mon Sep 17 00:00:00 2001 From: Timm Preetz Date: Tue, 28 Apr 2020 07:51:13 +0200 Subject: [PATCH 6/6] Bump version before release --- packages/sign_in_with_apple/CHANGELOG.md | 4 ++++ packages/sign_in_with_apple/pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/sign_in_with_apple/CHANGELOG.md b/packages/sign_in_with_apple/CHANGELOG.md index 4c2a3b3b..fcf240a4 100644 --- a/packages/sign_in_with_apple/CHANGELOG.md +++ b/packages/sign_in_with_apple/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.1.0 + +- Expose `identityToken` to enable Firebase integration (https://github.com/aboutyou/dart_packages/issues/62) + ## 2.0.0+5 - Extend integration docs for iOS and macOS diff --git a/packages/sign_in_with_apple/pubspec.yaml b/packages/sign_in_with_apple/pubspec.yaml index f502d434..6d4d044e 100644 --- a/packages/sign_in_with_apple/pubspec.yaml +++ b/packages/sign_in_with_apple/pubspec.yaml @@ -1,6 +1,6 @@ name: sign_in_with_apple description: Flutter bridge to initiate Sign in with Apple (on iOS, macOS, and Android). Includes support for keychain entries as well as signing in with an Apple ID. -version: 2.0.0+5 +version: 2.1.0 homepage: https://github.com/aboutyou/dart_packages/tree/master/packages/sign_in_with_apple repository: https://github.com/aboutyou/dart_packages