Before diving into the solution, could you share how you're currently implementing the authentication flow? From your use of Process.Start
, it seems you're working on a desktop application. Have you tried running the sample web app from the APS tutorials: https://github.com/autodesk-platform-services/aps-hubs-browser-dotnet
In that tutorial, there's a section that explains how the API controller handles authentication: https://get-started.aps.autodesk.com/tutorials/hubs-browser/auth#server-endpoints
The GET /login
endpoint redirects the user to the APS authorization page.
The GET /callback
endpoint is where APS sends the authorization code after the user grants access.
This code is typically returned via a browser redirect to your redirectUri
. The APS authorization server can't directly call your app—it sends a response that includes a form with JavaScript that automatically redirects the browser to your callback URL, appending the code
as a query parameter.
If you're using Process.Start
to open the authorization URL, make sure your app is also set up to listen for incoming requests on the callback URI. For desktop apps, this often means running a local HTTP listener (e.g., using HttpListener
in .NET) that waits for the redirect and extracts the code
from the query string.