Device registration (aka Dynamic Client Registration - DCR)

To initialize user registration the device must be registered. These credentials are received via device registration. As an app developer there is no need to initialize device registration because it is automatically triggered by the SDK. Errors can occur during device registration, these errors are reported back to the app via the delegates that you pass to the SDK methods. For device registration the app needs to identify itself to the Token Server. This is done by sending the identifier, version and platform of the app. Furthermore the app needs to provide proof of it's identity to the Token Server. In the Token Server administration console we refer to this as the application signature. To generate the application signature please see generating the application signature. As a timestamp is used within the device registration protocol it is mandatory that the time on the device is equal to the time on the Token Server, independent of time zones. The maximum time offset is ten minutes. There are two common reasons why device registration would fail: First the time on the device not being in sync and second the application version not properly configured in the token server. The SDK does not provide the app with an error other then a general device registration error since it is not able to distinguish what error did occur. The result of successful Dynamic Client Registration are client credentials. Those are made of clientId and clientSecret. The SDK stores them securely on the device in the keychain. Of those two, you can only retrieve the clientId. It is done using the -[ONGDeviceClient clientIdWithError:] method.

NSError *dataAccessError = nil;
NSString *clientId = [[ONGDeviceClient sharedInstance] clientIdWithError:&dataAccessError];
if (dataAccessError) {
    // handle data access error