Hi all,
Im having an issue getting the Forge access key through a .net webbrowser for my first attempt at a 360docs Forge application.
Everything works in Postman, the URL also works when pasted into IE11.
My webbrowser brings up the username and password forms successfully but on pressing 'Allow' in the Authorize application form I'm struggling to capture the access token, the button registers the click but the WebBrowserNavigatedEventArgs event isn't firing.
I would be grateful for any advice given
Here's my current code
public Form1() { InitializeComponent(); webBrowser1.ScriptErrorsSuppressed = true; string clientID = Environment.GetEnvironmentVariable("B2VClientId", EnvironmentVariableTarget.User); string forgeRedirectUrl = Environment.GetEnvironmentVariable("B2VForgeRedirectUrl", EnvironmentVariableTarget.User); string forgeScope = Environment.GetEnvironmentVariable("B2VForgeScope", EnvironmentVariableTarget.User); webBrowser1.Url = new Uri("https://developer.api.autodesk.com/authentication/v1/authorize?" + "response_type=token" + "&client_id=" + clientID + "&redirect_uri=" + forgeRedirectUrl + "&scope=" + forgeScope); } private void webBrowser1_Navigated(object sender, WebBrowserNavigatedEventArgs e) { var url = e.Url.ToString(); if (url.Contains("access_token")) { MessageBox.Show(url); } }
Hi @GrahamB8,
I think the blog our colleague wrote has demoed how to work with 3legged token workflow with webbrowser.
https://forge.autodesk.com/cloud_and_mobile/2016/10/3-legged-oauth-on-desktop-apps-c-winform.html
Could you check it helps your case?
Can't find what you're looking for? Ask the community or share your knowledge.