This sample demonstrates a quick workflow to generate a three legged token from a desktop app using 3-Legged Token with Authorization Code Grant (PKCE)
The token is retrieved at the windows form app, using the UI below:
1 – Clicking on generate token triggers the process
2 – You also have the option to refresh a token with the button
3 - Once the process is done, the token will be posted in the texbox
We used the workflow below to obtain the token
Where:
A – The user access the Desktop app and the app redirects the user to authorization server with app credential and a code challenge generated from a random string used as a code verifier.
B – After logging in and allowing access, authorization server sends credential code to call-back url and this request is intercepted by the desktop app.
C – Desktop app sends credential code with code verifier to Exchange it for a token
D – Oauth API returns the token (including refresh token) to desktop app
- APS Account: Learn how to create a APS Account, activate subscription and create an app at this tutorial.
- Visual Studio: Community or Pro.
- .NET basic knowledge with C#
Clone this project or download it. It's recommended to install GitHub desktop. To clone it via command line, use the following (Terminal on MacOSX/Linux, Git Shell on Windows):
git clone https://github.com/autodesk-platform-services/aps-pkce-desktop-app
Visual Studio (Windows):
Go to properties folder and then double-click on resources and change client id and callback url with your own.
-
Not being redirected: Make sure to add your callback url to your aps app.
-
Not retrieving the token: Make sure you've provided the proper callback to httplistener
-
Not able to read ACC/BIM 360 data with acquired token: Make sure to provision the APS App Client ID within the BIM 360 Account, learn more here. This requires the Account Admin permission.
This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.
João Martins in/jpornelas, Adam Nagy in/adamnagy APS Partner Development