Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use "Sign In with Apple" with Apple JS

I would use "Sign In with Apple" in the web via Apple JS. The code example can be found here: https://developer.apple.com/documentation/signinwithapplejs/configuring_your_webpage_for_sign_in_with_apple

The question now is: what is the Client ID and where can I find it. I tested the identifier of the app id on https://developer.apple.com/account/resources/identifiers/list and I tested the identifier of the service id. If I click on the button and verify with Touch ID on my mac, I got the error "AUTH_ALERT_SIGN_UP_NOT_COMPLETED":

enter image description here

This is the used code:

<html>
    <head>
    </head>
    <body>
        <button id="sign-in-with-apple-button"> Sign In with Apple </button>
        <script type="text/javascript" src="https://appleid.cdn-apple.com/appleauth/static/jsapi/appleid/1/en_US/appleid.auth.js"></script>
        <script type="text/javascript">
            AppleID.auth.init({
                clientId : 'unknown',
                scope : 'email',
                redirectURI: 'https://mytld/test.php',
                state : 'DE'
            });

            const buttonElement = document.getElementById('sign-in-with-apple-button');
            buttonElement.addEventListener('click', () => {
                AppleID.auth.signIn();
            });
        </script>
    </body>
</html>

I got no request on test.php.

like image 505
Hanashi Avatar asked Jun 04 '19 11:06

Hanashi


People also ask

How do you use Sign in with Apple?

You can also use Sign in with Apple on participating apps and websites on the web and on other platforms like Android or Windows. Tap the Sign in with Apple button on the participating app or website. When you see a secure, Apple-hosted webpage, enter your Apple ID and password.

How does react JS integrate with Apple login?

Go to the AWS Amplify Console and create a new backend app. Choose a name for your project, and then open up the Admin UI once your project is initialized. Click "Enable authentication" in the Admin UI. Under "Add a Login Mechanism" choose "Sign in with Apple".

Why cant I use Sign in with Apple?

If you get a message that your Apple ID is locked or disabled. If you or someone else enters your password, security questions, or other account information incorrectly too many times, your Apple ID automatically locks to protect your security and you can't sign in to any Apple services.

Which apps allow Sign in with Apple?

To use Sign in with Apple, download and open an app that supports the feature. A few apps you can try are Adobe Reader, Airbnb, Dropbox, eBay, Groupon, Instacart, Kayak, The New York Times, Squarespace, Spotify, TikTok, and WordPress.


1 Answers

Client ID is the "Identifier" of your Service ID that has "Sign In with Apple" enabled:

Service ID Configuration

Apple recommends you make it the following format on the Register a Service ID screen:

We recommend using a reverse-domain name style string (i.e., com.domainname.appname). It cannot contain an asterisk (*).

like image 165
Kaspars Avatar answered Oct 01 '22 12:10

Kaspars