This basic .NET Core WebAPI sample implements a basic list of Buckets and Objects with an Autodesk Forge 2 Legged OAuth.
3 Legged Authentication is also available, you can switch between the two OAuth services.
The front-end was desiged with pure HTML + JavaScript (jQuery, Bootstrap). It includes: create and delete buckets, upload, delete and translate object (including .zip
files). This code is based on this tutorial.
- Forge Account: Learn how to create a Forge Account, activate subscription and create an app at this tutorial.
- Visual Studio: Either Community 2017+ (Windows) or Code (Windows, MacOS).
- .NET Core basic knowledge with C#
- JavaScript basic knowledge with jQuery
- ngrok: Routing tool, download here
Clone this project: git clone github.com/Autodesk-Forge/model.derivative-WebAPI-sample.git
Visual Studio (Windows):
Right-click on the project, then go to Debug. Adjust the settings as shown below.
Visual Sutdio Code (Windows, MacOS):
Open the folder, at the bottom-right, select Yes and Restore. This restores the packages (e.g. Autodesk.Forge) and creates the launch.json file. See Tips & Tricks for .NET Core on MacOS.
At the .vscode\launch.json
, find the env vars and add your Forge Client ID, Secret and callback URL. Also define the ASPNETCORE_URLS
variable. The end result should be as shown below:
"env": {
"ASPNETCORE_ENVIRONMENT": "Development",
"ASPNETCORE_URLS" : "http://localhost:3000",
"FORGE_CLIENT_ID": "your id here",
"FORGE_CLIENT_SECRET": "your secret here",
"FORGE_WEBHOOK_URL": "your ngrok address here: e.g. http://abcd1234.ngrok.io",
},
Run ngrok http 3000
to create a tunnel to your local machine, then copy the address into the FORGE_WEBHOOK_URL
environment variable.Ngrok is a cross-platform application that exposes local server ports to the Internet.
Documentation: