Skip to content

Sample to demonstrate a way to acquire a PKCE 3LO in a windows form app

License

Notifications You must be signed in to change notification settings

autodesk-platform-services/aps-pkce-desktop-app

Repository files navigation

APS-PKCE-DESKTOP-APP

Platforms .NET License

oAuth2

Introduction

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)

How it works

The token is retrieved at the windows form app, using the UI below:

formui Where:

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

diagram

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

Setup

Prerequisites

  1. APS Account: Learn how to create a APS Account, activate subscription and create an app at this tutorial.
  2. Visual Studio: Community or Pro.
  3. .NET basic knowledge with C#

Running locally

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.

Further Reading

Troubleshooting

  1. Not being redirected: Make sure to add your callback url to your aps app.

  2. Not retrieving the token: Make sure you've provided the proper callback to httplistener

  3. 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.

License

This sample is licensed under the terms of the MIT License. Please see the LICENSE file for full details.

Written by

João Martins in/jpornelas, Adam Nagy in/adamnagy APS Partner Development

About

Sample to demonstrate a way to acquire a PKCE 3LO in a windows form app

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages