Skip to content

Authentication

Before using the SDK, point both the SDK and the service client to the Prove ID environment:

import RKYC_iOS
import ProveIDApiClient
let serverUrl = "https://test.api.proveid.io" // test
// let serverUrl = "https://api.proveid.io" // production
EndpointManager.SERVER_URL = serverUrl
ProveIDApiClientAPI.basePath = serverUrl

Do this once when the app starts, for example in application(_:didFinishLaunchingWithOptions:).

Every ProveIDApiClient call sends the headers in ProveIDApiClientAPI.customHeaders. Set the access token there:

ProveIDApiClientAPI.customHeaders["Authorization"] = "Bearer \(accessToken)"

The recommended setup, as with the Web SDK, is to obtain the access token on your server and hand it to the app as a short-lived token. When it expires, get a new one from your server and set the header again.