Set up your OAuth 2.0 app
This guide describes how to set up and configure an application using the Authorization Code grant type. This flow is used by web applications to securely obtain an access token by redirecting the user to the Hootsuite login page.
- User Interaction: Requires the user to manually authorize the app via a browser.
- Highly Secure: The
client_secretis only exchanged server-side for the final token.
Step 1: Configure your Redirect URL​
Go to https://hootsuite.com/dashboard#/app-directory/developers/my-apps, click on your app, go to Security -> Rest API and you will have the option to manage your redirect uris.
Step 2: Request an Authorization Code​
Redirect the user's browser to the Hootsuite authorization page. This is where the user grants your app permission to access their account.
🔗 Authorization URL​
To begin the flow, have your application redirect the user to this URL:
[https://platform.hootsuite.com/oauth2/auth?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=offline](https://platform.hootsuite.com/oauth2/auth?response_type=code&client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&scope=offline)
Step 3: Exchange the Code for a Token​
Once you receive the code back from the redirect, your server must exchange it for an access token.
🔑 The Exchange Request (curl)​
Use this command server-side to get your token. Note the use of Basic Auth (-u) for your credentials.
curl -X POST \
-u "YOUR_CLIENT_ID:YOUR_CLIENT_SECRET" \
-d "grant_type=authorization_code" \
-d "code=AUTH_CODE_RECEIVED" \
-d "redirect_uri=YOUR_REDIRECT_URI" \
"[https://platform.hootsuite.com/oauth2/token](https://platform.hootsuite.com/oauth2/token)"
Step 4: Handle the Token Response​
A successful exchange returns the access token and a refresh token.
✅ Expected Response​
{
"access_token": "ACCESS_TOKEN_STRING",
"token_type": "Bearer",
"expires_in": 2592000,
"refresh_token": "REFRESH_TOKEN_STRING",
"scope": "offline"
}
What's Next?​
With your access_token ready, you can now start making authenticated calls to the Hootsuite API.