Browse SDKs · iOS
Platform
SDKsiOSEnterprise

Retrieve room credentials

Retrieve credentials for joining a room by room ID with the OpenIM iOS SDK.

Copy

Retrieve the credentials required to enter a call room by room ID using signalingGetTokenByRoomID:onSuccess:onFailure:.

Parameters

ParameterTypeRequiredDescription
roomIDNSString *YesTarget call room identifier. (Certain SDK headers denote this selector argument as groupID, but pass the actual room ID).

Code example

[[OIMManager manager] signalingGetTokenByRoomID:roomID
                                      onSuccess:^(OIMInvitationResultInfo * _Nullable credentials) {
    if (credentials.roomID.length > 0) {
        [self joinMediaRoom:credentials];
    }
}
                                      onFailure:^(NSInteger code, NSString * _Nullable message) {
    [self showCallError:code message:message ?: @"Failed to retrieve room credentials"];
}];

Return value

The onSuccess callback delivers an OIMInvitationResultInfo instance containing the room identifier (roomID), RTC room access token (token), and live media URL (liveURL). Connect to your media engine once valid credentials arrive. When media credentials expire or during connection recovery, invoke this method again to refresh credentials.