parseAuthorizationCredentialAppleID function
Implementation
AuthorizationCredentialAppleID parseAuthorizationCredentialAppleID(
Map<dynamic, dynamic> response,
) {
if (response['type'] == 'appleid') {
final authorizationCode = response['authorizationCode'] as String?;
if (authorizationCode == null) {
throw const SignInWithAppleAuthorizationException(
code: AuthorizationErrorCode.invalidResponse,
message:
'parseAuthorizationCredentialAppleID: `authorizationCode` field was `null`',
);
}
return AuthorizationCredentialAppleID(
userIdentifier: response['userIdentifier'] as String?,
givenName: response['givenName'] as String?,
familyName: response['familyName'] as String?,
email: response['email'] as String?,
authorizationCode: authorizationCode,
identityToken: response['identityToken'] as String?,
state: response['state'] as String?,
);
} else {
throw Exception('Unsupported result type ${response['type']}');
}
}