Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Verify backend calls from iOS app

Tags:

I am trying to find an equivalent of this Android verification but for iOS.

Initially posted in a blog post but now incorporated into the main android documentation, the verification lets you know 3 things: Then, you know that:

  1. The token was issued by Google.
  2. The token was sent to a device that was being operated by the person identified in the payload's email field.
  3. The token was obtained by the Android app identified by the Client ID in the payload’s azp field.

The key point is that:

GoogleAuthUtil will observe that the Android app and the web client ID are in the same project, and without user approval, return an ID token to the app, signed by Google.

Therefore, I am able to verify backend calls, without disrupting the user.

Is there somethings similar for iOS from Apple, where I can get a ID token signed by Apple when Apple will observe that the iOS app and the web client ID?

I have found a SO question trying to find something similar, but I am hoping for a simpler solution. That question was more than a year ago, so I am hoping there maybe a better answer, possibly with the new CloudKit web services.

like image 759
yet another programmer Avatar asked Aug 02 '15 04:08

yet another programmer


People also ask

What is the backend for iOS apps?

The backend operates on the server, and it's that part of the app that you don't see, but your mobile app depends on it for functionality. A mobile backend takes care of: Data processing and storage independent of a smartphone's capabilities. Data sync and sharing across multiple devices and platforms.

What is App attestation?

The App Attest service tracks the keys that you generate in this mode separately from the keys generated in production mode. This allows you to generate and attest any number of keys on a given device without polluting that device's production key count.

How do I validate my Apple device?

Sign in with your Apple ID and password on a new device or browser. Look for a sign in notification on any of your trusted devices. Tap Allow to receive your verification code. Enter the verification code on your other device to complete sign in.


1 Answers

Luckily I've come across this thread on stackexchange where the user Iwaz left a comment.

Iwaz is pointing at Apple's DeviceCheck Framework that can be used to verify if a call to your API comes from an actual installation of your iPhone App.

According to the docs it works as follows:

  1. Get the current DCDevice by calling DCDevice's currentDevice method.
  2. From that DCDevice call its generateTokenWithCompletionHandler method to obtain a token.
  3. Send that token along with your other data when making requests to your API.
  4. In your API server code, call Apple's API by providing the token to validate it as described here.
like image 132
Christian Avatar answered Sep 19 '22 12:09

Christian