Obtain Login Signature for 'Linkus SDK for Web'

When initializing 'Linkus SDK for Web', users are required to authenticate with the SDK login signature. This topic describes how to request users' Linkus SDK login signatures from the PBX server via OpenAPI.

Prerequisites

You have enabled Linkus SDK on Yeastar P-Series PBX System.

Authentication process

Step 1. Obtain the 'AccessID' and 'AccessKey' for Linkus SDK on PBX

Obtain the 'AccessID' and 'AccessKey' for Linkus SDK from Yeastar P-Series PBX System, which will be used for the third-party application to authenticate and connect with the PBX server.

  1. Log in to PBX web portal, go to Integrations > Linkus SDK.
  2. Note down the AccessID and AccessKey.

Step 2. Request an access token from PBX

On the third-party application server, use the 'AccessID' and 'AccessKey' to request an access token from the PBX via OpenAPI. Access token is used to verify an authenticated API call, enabling you to request Linkus SDK login signatures for extensions.
Request URL
POST {base_url}/openapi/v1.0/get_token
Note: To learn about the API request structure, see Request Structure.
Request Parameters
Parameter Required Type Description
username Yes String User name.

Use the AccessID of Linkus SDK as the username.

password Yes String Password.

Use the AccessKey of Linkus SDK as the password.

Request example
POST /openapi/v1.0/get_token
Host: 192.168.5.150:8088
Content-Type: application/json
{
	"username": "VXKkvsR2w5H28JAWtBXuJHMTeaQO7Zmf",
	"password": "Yq6yVsBceOZLhnuaGeMUG4U4qXXXXXXX"
}
Response parameters
Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed.
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
access_token_expire_time Integer Access token expire time. (Unit: second)
access_token String Credential of calling API interfaces. All requests to call API interfaces must carry an access token.
refresh_token_expire_time Integer Refresh token expire time. (Unit: second)
refresh_token String Refresh token.

refresh_token can be used to obtain new access_token and refresh_token.

Response example
HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "access_token_expire_time": 1800,
    "access_token": "EXZMpZAO86mbrKm6rFtgeb3rfcpC9uqS",
    "refresh_token_expire_time": 86400,
    "refresh_token": "SCduGecwbG9jIusiS8FxFUVn3kf0Q9R8"
}

Step 3. Request login signatures for extensions

Use the access token to request login signatures for extensions from PBX server via OpenAPI.
Request URL
POST /openapi/v1.0/sign/create?access_token={access_token}
Request Parameters
Parameter Required Type Description
username Yes string Extension number or email address.
sign_type Yes string Login signature type.

Permitted value: sdk

expire_time No Integer Expiration timestamp of the login signature. (Unit: second)

0 indicates no limitation on the validity duration of the login signature.

Request example
POST /openapi/v1.0/sign/create?access_token=EXZMpZAO86mbrKm6rFtgeb3rfcpC9uqS
Host: 192.168.5.150:8088
Content-Type: application/json
{
	"username": "1000",
	"sign_type": "sdk",
       "expire_time": "0"
}
Response parameters
Parameter Type Description
errcode Integer Returned error code.
  • 0: Succeed.
  • Non-zero value: Failed
errmsg String Returned message.
  • SUCCESS: Succeed.
  • FAILURE: Failed.
data Array<Ext_Sign> Linkus SDK login signatures for extensions.
Ext_Sign
Parameter Type Description
sign String Extension's Linkus SDK login signature.
Response example
HTTP/1.1 200 OK
{
    "errcode": 0,
    "errmsg": "SUCCESS",
    "data":{
        "sign": "ueb3rfcpsiS8FxFUZMpZAO86mbrKmVn3kf0Q9R8"
    } 
}

Result

The third-party application server has obtained the Linkus SDK login signature for initializing 'Linkus SDK for Web'. The login signature will be automatically returned to the third-party application client, and passed to 'Linkus SDK for Web'.

What to do next

Use the login signature for authentication to integrate and initialize 'Linkus SDK for Web Core'.