How to Sign Out of Apple After Being Authenticated

前端 未结 1 1355
感情败类
感情败类 2021-01-04 05:00

My app has a \"Sign in with the Apple\" account feature. I am wondering if there is sign out feature from the Apple account.

I tried the below but doesn\'t get succe

相关标签:
1条回答
  • 2021-01-04 05:27

    Apple only allows currently for the user to perform a signout (iOS/watchOS/tvOS) or shown as a revoke of permissions to us. They recommend you get the state of the credentials before use to check for revoke and if that has occurred to delete any local information (Remove the user identifier where ever you have it stored) (And possibly change UI if needed; For example like showing login view).

            let appleIDProvider = ASAuthorizationAppleIDProvider()
        appleIDProvider.getCredentialState(forUserID: KeychainItem.currentUserIdentifier) { (credentialState, error) in
            switch credentialState {
            case .authorized:
                // The Apple ID credential is valid.
                break
            case .revoked:
                // The Apple ID credential is revoked.
                break
            case .notFound:
                // No credential was found, so show the sign-in UI.
                break
            default:
                break
            }
        }
    

    You could provide a prompt to the user on signout guiding them to revoke in their device's settings as well and listen for the change notification.

    0 讨论(0)
提交回复
热议问题