Quantcast
Channel: All Revit API Forum posts
Viewing all articles
Browse latest Browse all 66705

Re: Call forge api throught a revit plugin barrear

$
0
0

If it helps: that's the code for one of the forge API:

public static async Task <string> AuthenticateToken() { try { Uri baseUrl = new Uri("https://developer.api.autodesk.com/authentication/v1/authenticate"); var nvc = new List<KeyValuePair<string, string>>(); nvc.Add(new KeyValuePair<string, string>("client_id", _clientId)); nvc.Add(new KeyValuePair<string, string>("client_secret", _clientSecret)); nvc.Add(new KeyValuePair<string, string>("grant_type", "client_credentials")); nvc.Add(new KeyValuePair<string, string>("scope", "data:create data:read data:write")); var client = new HttpClient(); var content = new FormUrlEncodedContent(nvc); var response = await client.PostAsync(baseUrl, content); if (response.IsSuccessStatusCode) { string result = await response.Content.ReadAsStringAsync(); var jSon = (JObject)JsonConvert.DeserializeObject(result); string token = (string)jSon["access_token"]; return token; } } catch(Exception ex) { throw ex; } return null; }



And that's the exception that I get when I post it:

amilcarferreira_0-1634636333058.png

 


Viewing all articles
Browse latest Browse all 66705

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>