I've been trying to get a 3-legged authentication to work. I believe I've been to all resources Autodesk has online but unfortunately they all show different things and despite trying to piece it all together, I'm stuck again.
Below is all the material I've been through.
APS Tutorials https://aps.autodesk.com/en/docs/oauth/v2/tutorials/get-3-legged-token/ https://get-started.aps.autodesk.com/tutorials/hubs-browser/auth
Git SDK https://github.com/autodesk-platform-services/aps-sdk-net
.NET Reference Guide https://aps.autodesk.com/en/docs/oauth/v2/reference/dot-net-sdk/
Git APS Hubs sample code https://github.com/autodesk-platform-services/aps-hubs-recursive-extraction
I'm stuck at two points at the moment:
- I'm successfully getting a URL string from the Authorize() method however, my browser is not opening the URL automatically despite all the documentation saying it should. I'm currently calling Process.Start() to open that URL but it feels wrong.
- How do I get the authorisation code from the callback URL? All documentation I found only mentions the step after I have the code but it doesn't show how I can get it despite looking into lots of sample code Autodesk has online.
Sample code below.
SDKManager sdkManager = SdkManagerBuilder
.Create() // Creates SDK Manager Builder itself.
.Build();
var authClient = new AuthenticationClient(sdkManager);
var authURL = authClient.Authorize(clientId, ResponseType.Code, callbackUri,
new List<Scopes> { Scopes.DataRead, Scopes.ViewablesRead });
Process.Start(new ProcessStartInfo(authURL) { UseShellExecute = true });
