You can use devicecheck (in Swift 4) Apple documentation
func sendEphemeralToken() {
//check if DCDevice is available (iOS 11)
//get the **ephemeral** token
DCDevice.current.generateToken {
(data, error) in
guard let data = data else {
return
}
//send **ephemeral** token to server to
let token = data.base64EncodedString()
//Alamofire.request("https://myServer/deviceToken" ...
}
}
Typical usage:
Typically, you use the DeviceCheck APIs to ensure that a new user has not already redeemed an offer under a different user name on the same device.
Server action needs:
See WWDC 2017 — Session 702 (24:06)
more from Santosh Botre article - Unique Identifier for the iOS Devices
Your associated server combines this token with an authentication key that you receive from Apple and uses the result to request access to the per-device bits.