Authentication

API Access Mechanism using OAuth2

OVERVIEW

HighQ uses OAuth2 for all API access. 

Methodology to get an access token using OAuth:

There are multiple steps required to obtain an access token. 

1) Client Registration

This step starts by obtaining a client ID and secret key from HighQ.

HighQ will register the client in our OAuth Server and provide you with a client ID and secret key. Please note that the generated token is valid for a specific time.

Note:

Collaborate OAuth token is generated per Collaborate instance and is not centralised for all Collaborate instances, hence the API application registration is specific to a Collaborate instance and is independent of any other Collaborate instance. 
The integrator using the API registration from one Collaborate instance will have to change the OAuth credentials if they want their API integration to work with another Collaborate instance.
Due to this OAuth architecture we suggest that the OAuth details be saved in a configuration file or are easily changeable through an interface, so that code recompile is not required for a generic solution.  

The format of the API client registration is as under:

client_id:1012

client_secret:dp3yp9zm6svZzUqduQH4CEYC2VgjwWLO

2) Generate a OAuth code 

Using the client specific details call the following URL using the web browser. The client_id and redirect_uri is to be replaced for each client.

The redirect_uri is the URI from where the REST calls will be instantiated. 

https://<instancename.highq.com>/<instancename>/authorize.action?response_type=code&client_id=1012&redirect_uri=http://www.highq.com/ 

This will generate a code and append it as query string tag to the end of the redirect URI after execution of the above URL. Please save this code for later steps. 
Please note that this code is only valid for 30 minutes, if you do not use this code within 30 minutes of generation, you will need to regenerate a fresh code.

Note: Please change the <instancename> to your own instance name. 

3) Generate an access token

The final step is to create an access token which will be used on each subsequent request. (We suggest you use an API Client like SoapUI to execute these methods.)

The following post request is to be made to the below URI with the correct method and content-type as listed below. Please replace the client_id, client_secret and code (obtained in the earlier steps).

method:post
content-type;application/x-www-form-urlencoded
URI: https://<instancename.highq.com>/<instancename>/api/oauth2/token
Post Body: grant_type=authorization_code&client_id=1012&client_secret=dp3yp9zm6svZzUqduQH4CEYC2VgjwWLO&code=d6jJodLD2F

A sample response will look like this:

<TokenResponse>
   <access_token>E_MIswtXKguKZ21h1RlueUXQqFvyTCxw</access_token>
   <expires_in>2419200</expires_in>  (In seconds)
   <refresh_token>nincFU9Jv86YRiX3rsvgPlsv6tAc0Nks</refresh_token>
   <token_type>bearer</token_type>
   <useremail>user@clientname.com</useremail>
</TokenResponse> 

This gives you the actual access_token 

4) Call the API endpoints

Once you have obtained the access token, you can call the API endpoints by setting the Auth-Type and Authorization request headers.

As an example you can try out the following call to get a list of Collaborate sites:

https://<domain url>/<instancename>/api/<api version number>/sites

Domain URI is the URI of your clients Collaborate instance

The instance name is the name given to your client's instance and it can be determined by calling your clients domain name. 

API version if the version of the API you want to use, this depends on the Collaborate version and an explanation is listed here

Auth-Type:OAUTH2

Authorization:Bearer <access_token> 

replace the <access_token> in the above header

 

Using the Refresh Token

 

Please read the managing token expiration details to ensure OAuth token management

The OAuth2 access_token expires after a given time, specified in the expires_in parameter. Before the token expires, refresh_token can be used to obtain a new access_token.

The following is the methodology to obtain a new access_token: 

METHOD:POST

Content-Type:application/x-www-form-urlencoded

URL:http://clientinstance.highq.com/clientinstance/api/oauth2/token

POST value:

client_id=C003&client_secret=7B4AA1AD-24F2-477B-857F-796CD5D0E04D&grant_type=refresh_token&refresh_token=6529d221d9bbca85fc0967562a544d58
 

{
    "token_type": "bearer",
    "expires_in": "31536000",
    "access_token": "jAfvL0rpBGKix16iecuxxxxxxxxxxxxx",
    "refresh_token_expires_in": "31536000",
    "refresh_token": "BKLZvP5XEIlPIGc_ruwTj7xxxxxxxxxxx",
    "useremail": "user@domain.com"
}

Useful links

1)http://oauth.net/2/
2)http://developers.box.com/oauth/

 

Comments


51 Comments

Last Updated: Jun 10,2023