Подписать от Apple, используя FlutterIOS

Программируем под IOS
Anonymous
Подписать от Apple, используя Flutter

Сообщение Anonymous »

Как я могу выходить из Apple, используя Flutter
Я использую sign_in_with_apple < /strong> плагин +, когда я обозначаю Apple и пытаюсь распечатать электронную почту, я получаю null < /p>
Future signInWithApple() async {
// To prevent replay attacks with the credential returned from Apple, we
// include a nonce in the credential request. When signing in with
// Firebase, the nonce in the id token returned by Apple, is expected to
// match the sha256 hash of `rawNonce`.
SharedPreferences prefs=await SharedPreferences.getInstance();
final rawNonce = generateNonce();
final nonce = sha256ofString(rawNonce);

// Request credential for the currently signed in Apple account.
final appleCredential = await SignInWithApple.getAppleIDCredential(
scopes: [
AppleIDAuthorizationScopes.email,
AppleIDAuthorizationScopes.fullName,
],
nonce: nonce,
);

// Create an `OAuthCredential` from the credential returned by Apple.
final oauthCredential = OAuthProvider("apple.com").credential(
idToken: appleCredential.identityToken,
rawNonce: rawNonce,
);

prefs.setString("email", appleCredential.email.toString());
print("hello $appleCredential");
prefs.setString("mode", "apple");

// Sign in the user with Firebase. If the nonce we generated earlier does
// not match the nonce in `appleCredential.identityToken`, sign in will fail.
Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context)=>HomePage()), (route) => false);
return await FirebaseAuth.instance.signInWithCredential(oauthCredential);
}


Подробнее здесь: https://stackoverflow.com/questions/692 ... ng-flutter

Вернуться в «IOS»