Wie melde ich mich mit der Apple-ID mit JSON an und widerrufe das Token, wenn der Benutzer das Konto in Flutter/Dart dauIOS

Programmierung für iOS
Anonymous
 Wie melde ich mich mit der Apple-ID mit JSON an und widerrufe das Token, wenn der Benutzer das Konto in Flutter/Dart dau

Post by Anonymous »

Bisher habe ich es geschafft, diese zu bekommen

Code: Select all

String generateNonce([int length = 32]) {
final charset =
'0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._';
final random = Math.Random.secure();
return List.generate(length, (_) => charset[random.nextInt(charset.length)])
.join();
}

String sha256ofString(String input) {
final bytes = utf8.encode(input);
final digest = sha256.convert(bytes);
return digest.toString();
}
Und ich habe Sign-in-with-Apple für die Anmeldung verwendet.

Code: Select all

Future signInWithApple() async {
try {
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,
);

String authCodeString =
getAppleAuthorizationCode(appleCredential.authorizationCode);
log(authCodeString);

return await FirebaseAuth.instance.signInWithCredential(oauthCredential);
} on FirebaseAuthException catch (e) {
debugPrint(e.message);
debugPrint("CODE ${e.code}");
throw e;
}
}
Gemäß der aktuellen Anforderung von Apple müssen wir die Möglichkeit bieten, App-Berechtigungen und -Informationen für Benutzer auf Anfrage dauerhaft zu widerrufen. Wie machen wir das? Bitte helfen Sie mir, es so gut wie möglich zu verstehen. Danke ! :)

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post