Skip to content

Commit

Permalink
Merge pull request #63 from aboutyou/feature/expose-identity-token-again
Browse files Browse the repository at this point in the history
Expose identity token again
  • Loading branch information
tp authored Apr 28, 2020
2 parents 6a1a22e + 18aaf33 commit 5e700ce
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/sign_in_with_apple/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AuthorizationCredentialAppleID {
@required this.familyName,
@required this.email,
@required this.authorizationCode,
@required this.identityToken,
}) {
if (authorizationCode == null) {
throw SignInWithAppleAuthorizationException(
Expand Down Expand Up @@ -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})';
Expand Down Expand Up @@ -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']}');
Expand Down Expand Up @@ -149,5 +156,6 @@ AuthorizationCredentialAppleID parseAuthorizationCredentialAppleIDFromDeeplink(
givenName: user != null ? user['name']['firstName'] as String : null,
familyName: user != null ? user['name']['lastName'] as String : null,
userIdentifier: null,
identityToken: deeplink.queryParameters['id_token'],
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion packages/sign_in_with_apple/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down

0 comments on commit 5e700ce

Please sign in to comment.