Apple
Documentation
https://developer.apple.com/sign-in-with-apple/get-started/
Configuration
https://developer.apple.com/account/resources/identifiers/list/serviceId
Example
There are two ways you can use the Sign in with Apple provider.
Dynamically generated secret
If you use a dynamically generated secret you never have to to manually update the server.
tip
Mac
Convert your apple key to a single line to use as a environment variable.
Windows
Pre-generated secret
If you use a pre-generated secret you can avoid adding your private key as an environment variable.
tip
The TeamID is located on the top right after logging in.
tip
The KeyID is located after you create the Key look for before you download the k8 file.
Instructions
Testing
tip
Apple require all sites to run HTTPS (including local development instances).
tip
Apple doesn't allow you to use localhost in domains or subdomains.
The following guides may be helpful:
Example server
You will need to edit your host file and point your site at 127.0.0.1
On Windows (Run Powershell as administrator)
Create certificate
Creating a certificate for localhost is easy with openssl . Just put the following command in the terminal. The output will be two files: localhost.key and localhost.crt.
tip
On Windows?
The OpenSSL executable is distributed with Git for Windows.
Once installed you will find the openssl.exe file in C:/Program Files/Git/mingw64/bin
which you can add to the system PATH environment variable if it’s not already done.
Add environment variable OPENSSL_CONF=C:/Program Files/Git/mingw64/ssl/openssl.cnf
Create directory certificates
and place localhost.key
and localhost.crt
You can create a server.js
in the root of your project and run it with node server.js
to test Sign in with Apple integration locally:
Example JWT code
If you want to pre-generate your secret, this is an example of the code you will need: