POST https://restapi.actonsoftware.com/token
(As of July 2019, Grant Type Code requests are disabled by default for new developer accounts. If you would like to enable this option, please contact Act-On Support with the callback URL you would like to use.)
The grant type code method allows users to authorize your application to connect to their Act-On account and does not require you to store their username and password in your application.
Instead, they will be redirected to a page that requests an authorization. This will generate a one-time code that will be passed to your callback URL.
Parameters
Name | Parameter Type | Allow Multiple | Required/Optional | Data Type | Description |
grant_type | query | False | Required | string | The value must be set to 'authorization_code'. |
code | query | False | Required | string | The value from the callback URL code parameter. |
client_id | query | False | Required | string | The client ID you received in your welcome email. |
client_secret | query | False | Required | string | The client secret you received in your welcome email. |
redirect_uri | query | False | Required | string | The value must contain the redirect URL you set with Act-On Support. |
Example Method to Obtain Code Parameter
The following example URL will send users to the authentication page:
https://restapi.actonsoftware.com/authorize?scope=PRODUCTION&response_type=code&client_id=12345678-9abc-defg-hijk-lmnopqrs&redirect_uri=http://localhost
Note: An optional "state" parameter can be passed to your callback URL.
Once the user has signed in and authorized the response containing the grant code is sent to your callback URL.
http://localhost/?code=db5b2d1d7c569c6ef8166267ffffff
Your application will then use that code for the code parameter.
Response
{ "access_token": "12345678-9abc-defg-hijk-lmnopqrs", "refresh_token": "12345678-9abc-defg-hijk-lmnopqrs", "scope": "default", "token_type": "Bearer", "expires_in": 3600 }
Code Examples
cURL
curl -X POST https://restapi.actonsoftware.com/token -H "Content-Type: application/x-www-form-urlencoded" -d 'grant_type=authorization_code&code=12345967-1234-1234-1234-1234567891234&client_id=123456789abcdefghijklmnopqrs&client_secret=123456789abcdefghijklmnopqrs&redirect_uri=https://localhost'