Skip to content

Latest commit

 

History

History
93 lines (64 loc) · 4.63 KB

SETUP.md

File metadata and controls

93 lines (64 loc) · 4.63 KB

Table of contents

Apple Developer Account configurations

Create a new App ID

image

You need to create this even if you don't have an iOS or a Mac app image

Scroll down to "Capabilities", and find "Sign in with Apple" and check it. image

Hit continue and then register.

Create a services ID

image

Fill out the details here, and click configure on "Sign in with Apple". image

Add your domain that you'll use in the "Domains" section and the redirect url that you want to allow image

Click Continue and Register.

Now, you need to verify this domain and in order to do that, click on the Service ID that you just created, again, and click configure on "Sign in with Apple". When you do that, you should be able to see that there is a download and a verify button.

image

Create a key

Go to the "Keys" section in your Developer account and create one like this:

image

Click on configure on the "Sign in with Apple" option and make sure it is assigned to the correct App ID. Click continue and register. Now, click on Download and MAKE SURE YOU KEEP THE FILE SAFE AND SECURE! YOU CANNOT REDOWNLOAD IT ONCE YOU HAVE ALREADY DOWNLOADED IT

Configuring the library

Make a folder called "config" and add two files:

  • The private key file that you just downloaded
  • A new file called config.json

image

Inside of config.json, paste the following sample:

{
    "client_id": "",
    "team_id": "",
    "redirect_uri": "",
    "key_id": "",
    "scope": ""
}

The scopefield is to set what information we want to gather from the user. We can set email and/or name. This information is still not provided by Apple because this feature is still in Beta - but if you provide it the first time, when Apple finally releases it, your application will already have this permission provided. Otherwise the user has to revoke permissions to your application and log in again to be prompted for the new information request.

The client_id is actually called the "Service ID" that you will create in the 'Identifiers' section

image

The team_id is the 10 character code on the top left of the developer page next to your name. image

The redirect_uri is the return url you added in the developer portal image

The key_id is the identifier for the private key you generated image

You can now save this as config.json in the config folder.

Customizing the library

When building this project, it may be useful to enable a debugging mode. Enabling this mode will log all failed requests to the console, and the reject error message will also contain more specific information about the error. To enable this mode, pass in an object with the key debug set to true when initializing the library. For example:

let auth = new AppleAuth(
  config,
  SECRET_KEY,
  TEXT_METHOD,
  {
    debug: true
  }
);