Generate an Access Token Using the LinkedIn Marketing Solutions Public Workspace
Warning
Deprecation Notice
The Marketing Version 202311 (Marketing November 2023) and earlier versions (excluding 202306 and 202307) have been sunset. Additionally, the unversioned APIs will be sunset soon. We recommend that you migrate to the versioned APIs as well as migrate to the new Content and Community Management APIs to avoid disruptions. See the Migration page for more details.
If you haven’t yet migrated and have questions, submit a request on the LinkedIn Developer Support Portal.
Summary
The full process your application will need to implement for 3-legged tokens is described in Authorization Code Flow. The steps outlined below describe the process for using the public LinkedIn Marketing Solutions Postman workspace to generate OAuth tokens for testing.
Step 1 - Application
Go to the LinkedIn Developer Portal, select the app you'll be using, click the "Auth" tab, and locate your Client ID and Client Secret. Please note these values for use later during this process.
Step 2 - Auth Settings
From the same "Auth" tab, scroll to the bottom of the page. Under "OAuth 2.0 Settings", add the Postman callback URLs https://oauth.pstmn.io/v1/callback
and https://oauth.pstmn.io/v1/browser-callback
to your Redirect URL list.
Caution
Postman uses the term "Callback URL"
LinkedIn uses the term "Redirect URL"
Step 3 - Fork Collections and Environments
Navigate to LinkedIn's public Postman workspaces:
Choose the LinkedIn Marketing Solutions workspace and fork the collections and relevant environments of interest. Each collection will have an environment it should be used with. For example, the Campaign Management collection should be used with the campaign-management-env
environment.
Fork a Postman Collection
New! On the LinkedIn Marketing Solutions overview page, choose a 'Run in Postman' button to fork a collection and environment bundle or see how to manually fork each separately below.
Fork a collection:
Fork an environment:
Step 4 - Fill in Environment Variables
Fill in the environment variables as necessary. Values for Client ID and Client Secret are required to get an access token in the next step.
Step 5 - Headers
Each collection in the LinkedIn Marketing Solutions workspace will have its OAuth 2.0 Authorization settings pre-populated with the correct URLs, environment variables, and scopes to be able to successfully run the requests within the Use Cases folder. Ensure that the correct environment is selected and click "Get new access token":
- Grant Type: Authorization Code
- Callback (Redirect) URL:
https://oauth.pstmn.io/v1/browser-callback
- Note the Callback URL should be
https://oauth.pstmn.io/v1/callback
with the "Authorize using browser" box checked if you are using the Postman Desktop app
- Note the Callback URL should be
- Auth URL:
https://www.linkedin.com/oauth/v2/authorization
- Access Token URL:
https://www.linkedin.com/oauth/v2/accessToken
- Client ID: {using the client_id from the environment variables}
- Client Secret: {using the client_id from the environment variables}
- Scope: {
rw_ads,r_basicprofile,w_organization_social,w_member_social,rw_organization_admin
} - Client Authentication: Send client credentials in body
Step 6 - Identity Authentication
Postman will take you to the LinkedIn authorization page, where you may be prompted to log into LinkedIn. Click "Allow" to authorize the request. The prompt on the authorization page is dictated by the requested scopes in the previous step.
Step 7 - Use Token
Postman will then display your access token to be used for testing. Choose the 'Use Token' button to set this as the currently used token. The token will automatically be propagated to all requests within this collection.
Step 8 - Testing
Tip
Tip! When you first click on a collection name, the documentation pane on the right slide opens by default. On the bottom right, click 'view complete collection documentation' to gain a high-level overview of the documentation in the collection. You can modify the language of the example requests in this view.
Finally, send a request within the Use Cases folder. Ensure the correct environment is selected and that if any environment variables are being used in the request, ensure they are set in the associated Environment. For example, in the screenshot below, the request uses the campaign-management-token
and sponsoredaccount_id
variables from the campaign-management-env
environment.
Learn more about Postman Environments in Postman's online documentation
To see an example sample response, view the saved example