PBX API : GET /Personal/Token/

PBX token authentication assume two steps: token generation via api and use it in any request to PBX by adding GET parameter ?token=RETRIVED_TOKEN_HERE. In case successful token authentication page will be redirected to the same but without token parameter. Generated token can by used only for one authentication.

To generate token make an HTTP GET request with basic authorization, resource URI:

http(s)://{PBX}/api/v1/Personal/Token/

GET Parameters

Required Parameters

NameDescription

Optional Parameters:

NameDescription
typeJWT
servicegenerates a token for authentication to auth.wildix.com

example, for requesting token auth.wildix.com:

 

"https://10.100.1.135/api/v1/Personal/Token/?type=JWT&service=auth.wildix.com"


Response

TypeExample
Success{"type":"result","result":{"token":"mVDOmBDOknTMzczNkNWZxkTNNxAzMmM4YmEyYzJjMzljMTIxMDA1NzBkMmZk"}}
Warning 
Error{"type":"error","reason":"Unauthorized","result":null}

 

Logic for integration (MCU from wp600acg or mobile application, etc):

  1. Make Login (User login), it is better to use "remember" option (do not use basic auth!)
  2. Save cookie
  3. Make "GET /Personal/Token/" request with stored cookie (do not use basic auth, use cookie!)
  4. In case if Unauthorized response received, go to p.1, else go to p.5
  5. Make request to conference for example, https://<domain>/conf/<id>?token=RETRIVED_TOKEN
  6. NB! application can make procedure to retrieve token when message with link to conference was received.

 

Example with cURL
1) curl -i  --cookie-jar cook_15 -X POST -k  --url "https://10.100.1.135/api/v1/personal/login" --data-urlencode "login=15" --data-urlencode "password=wil01dix@@"
>>
HTTP/1.1 200 OK
X-Powered-By: PHP/5.3.6-6~dotdeb.0
Set-Cookie: PHPSESSID=03fd6bf32192ebfc9b93ac420513bcfb; expires=Thu, 28-Apr-2016 08:46:08 GMT; path=/
Set-Cookie: PHPSESSID=03fd6bf32192ebfc9b93ac420513bcfb; expires=Thu, 28-Apr-2016 08:46:08 GMT; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Type: application/json; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
P3p: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"
Transfer-Encoding: chunked
Date: Thu, 21 Apr 2016 08:46:08 GMT
Server: wildix-http-server
{"type":"result","result":"OK"}
 
2) curl -i --cookie cook_15 -X GET -k --url "https://10.100.1.135/api/v1/Personal/Token/"
>>
HTTP/1.1 200 OK
X-Powered-By: PHP/5.3.6-6~dotdeb.0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Set-Cookie: PHPSESSID=03fd6bf32192ebfc9b93ac420513bcfb; expires=Thu, 28-Apr-2016 08:46:43 GMT; path=/
Content-Type: application/json; charset=utf-8
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
P3p: CP="IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA"
Transfer-Encoding: chunked
Date: Thu, 21 Apr 2016 08:46:43 GMT
Server: wildix-http-server
{"type":"result","result":{"token":"mJWZykTMyMjZiZDZmNDMyYzMYzliOTNhYzQyMDUxM2JjZmI2NDk1NzE4OTM3"}}
 
x) cat cook_15
# Netscape HTTP Cookie File
# http://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
10.100.1.135    FALSE   /       FALSE   1461832966      PHPSESSID       d2b9116524524d93c36091f38d5cdc24