Generate Token
Use this method to generate token for WebRTC platform.
Resource
https://api.infobip.com/webrtc/1/token
Parameter | Type | Description |
---|---|---|
identity | string | The identity used to present user on Infobip WebRTC platform. Must be unique. Must contain at least 3 and at most 20 alphanumeric characters including - , _ , . . |
displayName | string | Optional. A human-readable name for a given identity. Does not have to be unique. If set, it will be presented to all other users communicating with the identified user, along with identity. Must contain at least 5 and at most 50 alphanumeric characters including - , _ , . , space . |
capabilities | object | Optional. The object containing permission for certain actions during the session. |
Header Params
Parameter | Type | Description |
---|---|---|
Authorization | string |
Authorization header |
Content-Type | string (application/json) | Content type, should be 'application/json' |
Request Example
POST /webrtc/1/token HTTP/1.1
Host: api.infobip.com
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Content-Type: application/json
Accept: application/json
{
"identity":"Alice",
"displayName":"Alice in Wonderland"
}
Response
{
"token": "3981e92d-141e-48bb-8e10-f751e0b4bfb5",
"expirationTime": "2019-02-06T11:10:00.123Z"
}
Authentication
For authentication, header details see Security and Authorization
Property name | Type | Description |
---|---|---|
identity | string | The identity used to present user on Infobip WebRTC platform. Must be unique. Must contain at least 3 and at most 20 alphanumeric characters including - , _ , . . |
displayName | string | Optional. A human-readable name for a given identity. Does not have to be unique. If set, it will be presented to all other users communicating with the identified user, along with identity. Must contain at least 5 and at most 50 alphanumeric characters including - , _ , . , space . |
capabilities | Capabilities | Optional. The object containing permission for certain actions during the session. |
Capabilities
Parameter | Type | Description |
---|---|---|
pstn | boolean | Whether to allow PSTN calls (calls sent to actual phone numbers, via `callPhoneNumber` method) during the session. If want to set to `true`, the capability must be enabled on account level (please contact your account manager for this). |
Response format:
If successful, the response header HTTP status code will be 200 OK
and the token will be received in the response body.
If you try to generate a token without authorization, you will receive the 401 Unauthorized
error.
If you try to generate a token without enabling WebRTC on your account, you will receive the 403 Nonexistent identity
error.
If you try to generate a token with capabilities that are not allowed for your account, you will receive the 403 Illegal options
error.
If you use this method too many times in a short period of time (more than 1000 requests in 1 minute), you will get status code 429 Too Many Requests
.
{
"token": "3981e92d-141e-48bb-8e10-f751e0b4bfb5",
"expirationTime": "2019-02-06T11:10:00.123Z"
}
Parameter | Type | Description |
---|---|---|
token | string | The access token used to connect client SDKs to Infobip WebRTC platform. |
expirationTime | datetime | Time point until which token is valid. The default value is 8h. If it expires, the user must be provided with the new valid token in order to continue using Infobip WebRTC platform. There is no notification about token expiry, you must track that by yourself. |