Generate an Access Token Using the LinkedIn Marketing Solutions Public Workspace

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.

LinkedIn Auth Tab

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"

Postman Callback URL

Step 3 - Fork Collections and Environments

Navigate to LinkedIn's public Postman workspaces:

Try in Postman

Try in Postman

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.

Environment Variables

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
  • 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

Set Authorization Parameters

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.

Authorize Scopes

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.

Postman Collection Documentation Postman Code Snippets

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

Make First API Call

To see an example sample response, view the saved example View Example Response