[英]How do I do sign in with apple ID with json and revoke token when user wants to permanently deactivate account in flutter/dart?
So far I have managed to get these到目前为止,我已经设法得到这些
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();
}
And I have used sign-in-with-apple for signing in.我已经使用苹果登录进行登录。
Future<UserCredential> 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;
}
}
As per recent requirement of apple, we need to provide option to permanently revoke app-permission and information for user upon request.根据苹果最近的要求,我们需要根据用户的要求提供永久撤销应用程序权限和信息的选项。 How do we do this?
我们如何做到这一点? Please help me understanding it as much as possible.
请帮助我尽可能地理解它。 Thank you: :)
谢谢: :)
This signin with apple is only an authentication method.这种使用苹果的登录只是一种身份验证方法。 Once a user authenticates using this method you will get a unique email or id of that user.
一旦用户使用此方法进行身份验证,您将获得该用户的唯一 email 或 id。 Then with this email you will be saving the user in your db or firebase.
然后使用这个 email,您将把用户保存在您的数据库或 firebase 中。 Apple wants us to create a mechanism where the users can permanently delete their account.
Apple 希望我们创建一种机制,让用户可以永久删除他们的帐户。 In this case you should be deleting this database entry permanently and logging out the user.
在这种情况下,您应该永久删除此数据库条目并注销用户。 They also approve manual deletion process where a person will manually delete the account from the db but we should provide an option for the user to initiate this processs from the app.
他们还批准手动删除过程,其中一个人将从数据库中手动删除帐户,但我们应该为用户提供一个选项以从应用程序启动此过程。 And it should be clearly visible saying delete account maybe.
并且应该可以清楚地看到删除帐户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.