oauthautodesk-forgeautodesk-construction-cloud

Autodesk ACC Forms access with two-legged OAuth Token


I'm attempting to use the ACC API to get the list of forms for a project but it fails with an HTTP 401 Unauthorized response that includes message "Authorization failed." This is while attempting to use a two-legged OAuth token, which I have successfully used for other ACC APIs, but the documentation indicates that a three-legged OAuth token is required for this particular endpoint. Using a three-legged token is not an option for the particular integration that I'm working on.

Has anyone else been able to use the Forms API with a two-legged OAuth token? For the APS support team that may see this, are there plans to support two-legged OAuth tokens for the ACC Forms API and when might that be implemented?


Solution

  • Unfortunately, ACC Forms API only supports three-legged access tokens right now, as documented.

    enter image description here

    However, we can use the SSA (Secure Service Account) API to provide a similar experience to the two-legged one, without requiring user logins.

    Exchanging a three-legged access token using a self-signed JWT Assertion with the RSA private key we obtained during the creation of the SSA.

    curl \
      --request POST \
      --url 'https://developer.api.autodesk.com/authentication/v2/token' \
      --header 'authorization: Basic xxx' \
      --header 'content-type: application/x-www-form-urlencoded' \
      --data 'grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer' \
      --data 'assertion=eyJraWQiOiI1ZGU5OTNmNC02MmIwLTQ5NWEtYTQzYS1iOTg5NmQ2ZTk1ODIiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJKbE85VEExempmSlFPR1h....m6aLBKUTE1Htwpk0MUYmvl7AF03XDgWjhwRnJVOk_MkdF44bjSCAmsQ5uTYbWipUJjDqUy38b4xiRRRB0_qsg_kZ-DBOAFzUtYN6ilA'