User token flow

User token flow

App user tokens authorize requests to SendPulse Service REST API, allowing specific actions on user account data based on scopes.

The token is valid for a limited time. To authorize a request later, you need to renew your token. Still, try to avoid making frequent requests so as not to overload SendPulse and get blocked.

Take a look at what the app user token flow looks like:

To get an app user token, send a POST request to:

https://api.sendpulse.com/oauth/access_token/market

Request parameters:

client_id string App user key*
client_secret string App user key*
grant_type string Equal to client_credentials

*App user keys (client_id and client_secret) are different from the keys that the user can find in their account settings. App user keys can only be obtained through the authorization flow.

Request example:

{ "client_id": "b2bfd8a8441294fa0171c195ada8cf56", "client_secret": "f7064fb0bbecd392d7b3ea2e2bd77758", "grant_type": "client_credentials" }

Response example if the request is successful:

{ "token_type": "Bearer", "expires_in": 7200, "access_token": "eyJ0eXAiOiJKV1Q...Bv1L" }

Response parameters:

token_type string Token type.
expires_in int Token lifetime. The default lifetime is 60 minutes.
access_token string App user token.

If your request is unsuccessful, you will receive an error 401 Unauthorized.

Response example if the request is not successful:

{ "error": "invalid_client", "error_description": "Client authentication failed", "message": "Client authentication failed" }

If you received an error, check the data you used, and send the request again.

Rate this article about "User token flow"

User Rating: 4 / 5

Previous

User authorization flow

Next

Uninstall flow

Popular in Our Blog

Try SendPulse today for free