Backend server code for communicating with Apple's Device Check API.
You will need an Apple Developer account before proceeding.
-
Go to https://developer.apple.com/account/ios/authkey/ and create a new key by clicking the '+' button.
-
Give the key a name, check 'DeviceCheck' in the Key Services, click 'Continue', then download the key. Copy the Key ID shown on the download page as well.
-
Create an app in Heroku panel, then go to Settings tab, and add Config Vars like this :
- Add DEVICE_CHECK_KEY_ID, DEVICE_CHECK_TEAM_ID and DEVICE_CHECK_KEY_STRING into config vars.
- The value of DEVICE_CHECK_KEY_ID is the Key ID you copied on step 2.
- The value of DEVICE_CHECK_TEAM_ID is your Apple developer account Team ID.
- The value of DEVICE_CHECK_KEY_STRING is the content of the key file (.p8) you downloaded. You can open the key file using TextEdit app, it should start with '-----BEGIN PRIVATE KEY-----' , copy the whole text in the file (including the line 'begin private key' and 'end private key') and paste it to Heroku.
- Link this repository (or your Fork) in the Deploy tab of the Heroku app, then click 'Deploy Branch' 🚀
- Your iOS app should can connect to https://your-app.heroku.com/reward or https://your-app.heroku.com/reset
- Go to https://developer.apple.com/account/ios/authkey/ and create a new key by clicking the '+' button.
- Give the key a name, check 'DeviceCheck' in the Key Services, click 'Continue', then download the key. Copy the Key ID shown on the download page as well.
- Download/Fork this repository, edit the file .env.example .
- Replace DEVICE_CHECK_KEY_ID with the Key ID you copied earlier.
- Replace DEVICE_CHECK_TEAM_ID with your team ID, you can retrieve this value here : https://developer.apple.com/account/#/membership
- Replace DEVICE_CHECK_KEY_STRING with the content of the key file (.p8) you downloaded earlier. You can open this file with TextEdit app.
- Rename the file .env.example to .env
- Open terminal, navigate to this repo folder, run
bundle install
, then runruby app.rb
to run the server code. - Your iOS app should can connect to https://localhost:4567/reward or https://localhost:4567/reset