示例#1
0
    private void AttemptQuickLogin()
    {
        var quickLoginArgs = new AppleAuthQuickLoginArgs();

        // Quick login should succeed if the credential was authorized before and not revoked
        this._appleAuthManager.QuickLogin(
            quickLoginArgs,
            credential =>
        {
            // If it's an Apple credential, save the user ID, for later logins
            var appleIdCredential = credential as IAppleIDCredential;
            if (appleIdCredential != null)
            {
                PlayerPrefs.SetString(AppleUserIdKey, credential.User);
            }

            this.SetupGameMenu(credential.User, credential);
        },
            error =>
        {
            // If Quick Login fails, we should show the normal sign in with apple menu, to allow for a normal Sign In with apple
            Debug.LogWarning("Quick Login Failed " + error.ToString());
            this.SetupLoginMenuForSignInWithApple();
        });
    }
示例#2
0
    void QuickAppleLogin()
    {
        var quickLoginArgs = new AppleAuthQuickLoginArgs();

        this.appleAuthManager.QuickLogin(quickLoginArgs,
                                         credential =>
        {
            isLoggedInwithApple = true;
            // Received a valid credential!
            // Try casting to IAppleIDCredential or IPasswordCredential
            // Previous Apple sign in credential
            var appleIdCredential = credential as IAppleIDCredential;
            // Saved Keychain credential (read about Keychain Items)
            var passwordCredential = credential as IPasswordCredential;
            if (appleIdCredential != null)
            {
                var identityToken = Encoding.UTF8.GetString(appleIdCredential.IdentityToken,
                                                            0, appleIdCredential.IdentityToken.Length);

                IToken = identityToken;
            }
        },
                                         error =>
        {
            // Quick login failed. The user has never used Sign in With Apple on you
        });
    }