Authentication
  • 20 Feb 2023
  • 1 Minute to read
  • Dark
    Light

Authentication

  • Dark
    Light

Article Summary

Authentication

API_key Authentication

For each method call, you must use your email and API_KEY.Authentication to the API is done via HTTP Basic Auth.Provide your email as the basic auth username and API_KEY as the password. You must authenticate for API requests.Even though we still support this type of authentication, we recommend using Oauth authentication.

When using API key to call the interface, you need to bring the parameter siteId.
For Example: GET https://api11.comm100.io/v4/livechat/campaigns?siteId=10000

Refer to this guide on How to get API Key and call API with API Key authentication

Oauth Authentication

You can use OAuth2 to authenticate all your API requests to Comm100. OAuth provides a more secure way for your application to access your account data without requiring sensitive information like email and password to be sent with the requests. There are different OAuth flows for different types of API.

Note that while generating an access token, the API request should start with your platform domain, which is different from other API requests. For example:

How to get the access token?

  • Using curl

POST oauth/token
Params:

NameTypeRequiredDescription
emailstringyesEmail of the agent account.
passwordstringyesPassword of the agent account.
grant_typestringyesSpecify password as the value.
client_idstringyesClientId of the oauth client. Go to the control panel / global settings / security/ OAuth Client / Edit OAuth client page to get the client_id.
  • Example

Sample Request:

curl https://dash11.comm100.io/oauth/token \ 
-X 'POST' \ 
-H 'Content-Type: application/x-www-form-urlencoded' \ 
-D 'grant_type=password&email={comm100_agent_email}&password={comm100_agent_password}&client_Id={comm100_oauthClient_clientId}' 

Response:
 HTTP/1.1 200 OK

 {  
       "access_token":"vQAQmLX8jvtsG71ItN2QAisqI_F7cDIE0yaX0FfS3RX6g-HR4gfHSVMaOukomYJiJX0Q", 
       "token_type":"bearer", 
       "expires_in":43199, 
       "refresh_token":"91a728cdd4c64fb7b128f74f4855c3daee44167ef60542a2b45c21e16373ed02" 
  }   

Refer to this Guide on How to call API with Oauth authentication


Was this article helpful?

What's Next