Libo Li

View Original

Setting up OAuth2.0 PKCE Grant in Autodesk Platform Services (Forge API) with Postman

The API formerly known as Forge (Autodesk Platform Services) is a fickle thing to work with. In this guide, we will walk through setting up Postman to Authorize with Autodesk Platform Services (subsequently abbreviated as APS) through a three-legged authorization grant with PKCE (Proof Key for Code Exchange)

After this guide, you should be able to authenticate and get tokens through OAuth2.0 to test Authenticated requests against APS. (Note, not all endpoints are available through this authentication method)

Step 0: Setup

Postman

In Autodesk Platform Services

An Autodesk Account

You should have:

  • Your Autodesk Account Information

  • The Client ID of your APS application

  • The Callback URL for OAuth2.0 in Postman: “https://www.getpostman.com/oauth2/callback

  • The APS Authentication URLs

  • Auth URL: “https://developer.api.autodesk.com/authentication/v2/authorize?response_type=code”

  • Token URL: “https://developer.api.autodesk.com/authentication/v2/token”

From here, things should be pretty straightforward.

Step 1: Configure Authorization in Postman

I like to set up requests to inherit from a parent folder or collection, but this configuration should work at any level.

In the Authorization Tab:

The resulting configuration should look something like this

Step 2: Get New Access Token

Click the “Get New Access Token” button and you should be taken through the authorization flow.

Postman will take you to APS for authorization

You will be greeted with a nice check when the flow succeeds

Once completed, you should be able to use the token to access the Autodesk Platform Services APIs that use this type of grant. If not valid, it will respond with the type of grant it requires.

Happy Coding!