Request

Response

    Desktop, Mobile, and Single-Page App

    Choose Desktop, Mobile, Single-Page App if you are creating a native application for a desktop computer or mobile device, or a single-page application (SPA), where the application will be deployed on end-user machines on which you cannot protect your application credentials. (An SPA is a special kind of web application that runs entirely in the end user’s browser without any page reloading, or transfer to other web pages.)

    This application type uses the Authorization Code grant type with a Proof Key for Code Exchange (PKCE). If you are using login via Implicit grant type, it is highly recommended that you switch to the more secure PKCE-based login.

    The Authorization Code grant type with PKCE is the same as the standard Authorization Code grant type with an extra step at the beginning and an extra verification at the end.

    Authorization Code Grant Type with PKCE

    At a high level, the authorization flow has the following steps:

    1. Your application generates a code verifier followed by a code challenge.
    2. Your application directs the browser to the APS login page, along with the generated code challenge, and the user authenticates.
    3. APS redirects back to your native application or SPA, with an authorization code.
    4. Your application sends this code, along with the code verifier, to APS. APS returns an access token, refresh token, and optionally an ID token.
    5. Your application can now use these tokens to call the resource server (for example, an API) on behalf of the user.

    Refer to Example 2 of this reference to see the complete flow using the Authorization Code grant type with PKCE.

    ../../../_images/desktop-mobile-spa.png

    There are a number of concepts that you need to be familiar with relevant to this application type and grant type:

    TermMeaning
    app The “app”, or “application”, is the code that you’re writing that calls APS APIs. It can be a web application, a headless server process, a mobile app, or even embedded firmware. Within the APS developer portal, your application is registered in the My Apps section.

    Sometimes “app” refers to your code; other times, it refers to the entity registered in the Dev Portal. It will be clear from context which is meant.
    When you register your application in the APS developer portal, you select the APIs that you want to bind it to. This ensures that even if you lose control of your authentication credentials, calls cannot be made on your behalf to APIs the application was not designed for.

    A registered application has assigned to it credentials called a “client ID” and “client secret.” These are analogous to a username and password, except that you do not select them; APS assigns them to your application. Your application uses these to obtain access tokens.
    client ID The “client ID” is essentially your application’s username and can be found in the My Apps section of the Autodesk DevPortal. It is a 32-character alphanumeric string (e.g., 5zw90va0UuwMKTnPS5sLsdgZjDkVYXN7). Your application passes it as the value for the client_id query parameter, and APS returns it in the client_id attribute in the returned JSON payload.

    Other platforms, sometimes call this a “consumer key” or “API key.”
    client secret The “client secret” is not supported by this application type as it assumes that your application cannot protect application credentials residing on the user’s computer or device.

    Other platforms sometimes call this a “consumer secret” or “API secret.”
    two-legged authentication Two-legged tokens are not supported by this application type.
    three-legged authentication When an application needs to access resources belonging to an end user, that user must explicitly provide authorization. The typical mechanism, in the case of a web application, is for the application to redirect the user to an Autodesk login page with information about which of the user’s resources it wishes to access. The user then provides explicit consent, authorizing APS to grant the referring application the requested access. APS then redirects the user back to the application, using a callback URL that you provide, and your application can then access the required resources.

    This kind of authentication is called “three-legged” because your application, APS, and the end user make up the three “legs” of the authentication. When you use the Authorization Code grant type, APS issues an authorization code to your application to exchange it to obtain access tokens and refresh tokens.
    callback URL In certain contexts, your application needs to hand over part of the authentication to APS. For example, in three-legged authentication for a web application, your application redirects the end user to an Autodesk login page, so that the user can tell APS that your application is authorized to act on the user’s behalf. The callback URL is what is passed to the Autodesk login page to tell it how to redirect the user back to your application.

    Callback URLs are specified in two places. You first register one or more callback URLs for your application in the My Apps section of the Autodesk DevPortal. Then, when you redirect your user to the Autodesk login page, you also specify the callback URL in the redirect_uri parameter. This allows you to use different callback URLs in different parts of your application. APS validates any run-time callback URLs against registered with your application.

    See the GET authorize documentation for more details on the relationship between the callback URL field and the redirect_uri parameter.

    Note that if your application does not require three-legged authentication, you can put any valid value in the callback URL field when you register your application, as no redirect_uri will ever be validated against it.
    Multiple callback URLs can be supported by the Traditional Web App application type.
    authorization code In a three-legged authorization code grant type, APS passes an authorization code as a query parameter it appends to the callback URL at the time it redirects the end user back to the application.

    Along with its client ID and secret, an application calls the POST token endpoint to exchange the authorization code for an access token.
    The authorization code is a 40-character string (e.g., wroM1vFA4E-Aj241-quh_LVjm7UldawnNgYEHQ8I).
    access token APS returns an access token (sometimes just “token” or “bearer token”) at the end of a successful authentication. APS uses JSON Web Tokens (JWT), which are alphanumeric strings of variable length (including periods to separate their different parts), that the application uses in subsequent API calls to the platform. The platform keeps track of what resources the token is entitled to access, and either allows or denies access at call time.

    Tokens have a limited lifespan and expire after a specified number of seconds.
     
    ______
    icon-svg-close-thick

    Cookie preferences

    Your privacy is important to us and so is an optimal experience. To help us customize information and build applications, we collect data about your use of this site.

    May we collect and use your data?

    Learn more about the Third Party Services we use and our Privacy Statement.

    Strictly necessary – required for our site to work and to provide services to you

    These cookies allow us to record your preferences or login information, respond to your requests or fulfill items in your shopping cart.

    Improve your experience – allows us to show you what is relevant to you

    These cookies enable us to provide enhanced functionality and personalization. They may be set by us or by third party providers whose services we use to deliver information and experiences tailored to you. If you do not allow these cookies, some or all of these services may not be available for you.

    Customize your advertising – permits us to offer targeted advertising to you

    These cookies collect data about you based on your activities and interests in order to show you relevant ads and to track effectiveness. By collecting this data, the ads you see will be more tailored to your interests. If you do not allow these cookies, you will experience less targeted advertising.

    icon-svg-close-thick

    THIRD PARTY SERVICES

    Learn more about the Third-Party Services we use in each category, and how we use the data we collect from you online.

    icon-svg-hide-thick

    icon-svg-show-thick

    Strictly necessary – required for our site to work and to provide services to you

    Qualtrics
    W
    Akamai mPulse
    W
    Digital River
    W
    Dynatrace
    W
    Khoros
    W
    Launch Darkly
    W
    New Relic
    W
    Salesforce Live Agent
    W
    Wistia
    W
    Tealium
    W
    Upsellit
    W
    CJ Affiliates
    W
    Commission Factory
    W
    Google Analytics (Strictly Necessary)
    W
    Typepad Stats
    W
    Geo Targetly
    W
    SpeedCurve
    W
    Qualified
    #

    icon-svg-hide-thick

    icon-svg-show-thick

    Improve your experience – allows us to show you what is relevant to you

    Google Optimize
    W
    ClickTale
    W
    OneSignal
    W
    Optimizely
    W
    Amplitude
    W
    Snowplow
    W
    UserVoice
    W
    Clearbit
    #
    YouTube
    #

    icon-svg-hide-thick

    icon-svg-show-thick

    Customize your advertising – permits us to offer targeted advertising to you

    Adobe Analytics
    W
    Google Analytics (Web Analytics)
    W
    AdWords
    W
    Marketo
    W
    Doubleclick
    W
    HubSpot
    W
    Twitter
    W
    Facebook
    W
    LinkedIn
    W
    Yahoo! Japan
    W
    Naver
    W
    Quantcast
    W
    Call Tracking
    W
    Wunderkind
    W
    ADC Media
    W
    AgrantSEM
    W
    Bidtellect
    W
    Bing
    W
    G2Crowd
    W
    NMPI Display
    W
    VK
    W
    Adobe Target
    W
    Google Analytics (Advertising)
    W
    Trendkite
    W
    Hotjar
    W
    6 Sense
    W
    Terminus
    W
    StackAdapt
    W
    The Trade Desk
    W
    RollWorks
    W

    Are you sure you want a less customized experience?

    We can access your data only if you select "yes" for the categories on the previous screen. This lets us tailor our marketing so that it's more relevant for you. You can change your settings at any time by visiting our privacy statement

    Your experience. Your choice.

    We care about your privacy. The data we collect helps us understand how you use our products, what information you might be interested in, and what we can improve to make your engagement with Autodesk more rewarding.

    May we collect and use your data to tailor your experience?

    Explore the benefits of a customized experience by managing your privacy settings for this site or visit our Privacy Statement to learn more about your options.