- 20 Feb 2023
- 1 Minute to read
- Print
- DarkLight
Authentication
- Updated on 20 Feb 2023
- 1 Minute to read
- Print
- DarkLight
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:
- If your Control Panel domain is dash11.comm100.io, the API request should start with https://dash11.comm100.io/.
- If your Control Panel domain is dash12.comm100.io, the API request should start with https://dash12.comm100.io/.
- If your Control Panel domain is dash13.comm100.io, the API request should start with https://dash13.comm100.io/.
- If your Control Panel domain is dash15.comm100.io, the API request should start with https://dash15.comm100.io/.
- If your Control Panel domain is dash17.comm100.io, the API request should start with https://dash17.comm100.io/.
How to get the access token?
Using curl
POST oauth/token
Params:
Name | Type | Required | Description |
---|---|---|---|
email | string | yes | Email of the agent account. |
password | string | yes | Password of the agent account. |
grant_type | string | yes | Specify password as the value. |
client_id | string | yes | ClientId 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