File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,33 @@ Future<UserCredential> signInWithApple() async {
224
224
}
225
225
```
226
226
227
+ #### Apple platform sign-in only
228
+
229
+ Apple sign-in on iOS+ platforms can also be achieved with the following method:
230
+
231
+ ``` dart
232
+ // Implement a function that generates a nonce. See iOS documentation for how to create a nonce:
233
+ // https://firebase.google.com/docs/auth/ios/apple#sign_in_with_apple_and_authenticate_with_firebase
234
+ String rawNonce = createNonce();
235
+ // Create a SHA-256 hash of the nonce. Consider using the `crypto` package from the pub.dev registry.
236
+ String hashSHA256String = createHashSHA256String(rawNonce);
237
+ // Use the hash of the nonce to get the idToken. Consider using the `sign_in_with_apple` plugin from the pub.dev registry.
238
+ String idToken = await getIdToken();
239
+
240
+ final fullName = AppleFullPersonName(
241
+ familyName: 'Name',
242
+ givenName: 'Your',
243
+ );
244
+ // Use the `rawNonce` and `idToken` to get the credential
245
+ final credential = AppleAuthProvider.credentialWithIDToken(
246
+ idToken,
247
+ rawNonce,
248
+ fullName,
249
+ );
250
+
251
+ await FirebaseAuth.instance.signInWithCredential(credential);
252
+ ```
253
+
227
254
### Revoke Apple auth tokens {:#revoke-apple}
228
255
229
256
Apple sign-in on Apple platforms returns an authorization code that can be used
You can’t perform that action at this time.
0 commit comments