简体   繁体   English

当用户想要永久停用 Flutter/dart 中的帐户时,如何使用带有 json 的 Apple ID 登录并撤销令牌?

[英]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.

相关问题 撤销 Apple 登录令牌以进行帐户删除过程 - Revoke Apple sign in token for account deletion process 在iOS上处理删除帐户时如何成功验证苹果撤销令牌api(appleid.apple.com/auth/revoke)? - How to validate the apple revoke token api (appleid.apple.com/auth/revoke) successfully when handle delete account on iOS? 如何在XCode 4.6.3上添加Apple ID帐户? - How do I add an Apple ID Account on XCode 4.6.3? 如何获取访问令牌以撤销现有的 Sign in with Apple 用户? - How to get access token to revoke for existing Sign in with Apple Users? 如果我从未请求过,我是否需要在使用 Sign-In with Apple 时从 Apple 撤销访问令牌? - Do I need to revoke access tokens from Apple while using Sign-In with Apple if I never requested them? 如何在 Apple Music 中创建个性化的音乐用户令牌? - How do I create a personalized Music User Token in Apple Music? 我如何查看 CloudKit 容器中 Apple ID 帐户而非开发者帐户的数据? - How do I see data in CloudKit container for Apple ID account other than developer account? 我可以在没有苹果开发者帐户的真实苹果设备上测试我的 Flutter 应用程序,如果可以,我该怎么做? - Can I test my Flutter application in a real apple device without apple developer account, and if so how do I do it? 更新xcode时如何在提示中更改Apple ID - How do I change the Apple ID in prompt when Updating xcode 如何仅使用普通的 Apple id 帐户签署 dylib? (还没有开发者账号) - How can I sign a dylib using just a normal apple id account? (No developer account yet)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM