29 Oct 2018

Token does not have the privilege for this request.

Issue:
When requesting an access token using data:read scope, I can successfully get the list of hubs using that token. However, I also need to create a new issue in BIM 360 and that requires a data:write scope. So I'm now requesting an access token using data:write scope, but then the request to get the list of hubs fail - see above image. 

Answer:
When requesting an access token, you have to include all the scopes that the various endpoints you will be calling need. The GET hubs endpoint needs data:read and the POST issues endpoint needs data:write - so you should add both when requesting an access token. The documentation of each endpoint highlights the scopes they need. 
See list of possible scopes: https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/scopes/

I'm quite sure that all of our samples provide multiple scopes when requesting an access token so you can have a look at any of them to see how to do it correctly.
https://github.com/autodesk-forge

 

Related Article

Posted By

Adam Nagy

Follow @AdamTheNagy Adam Nagy joined Autodesk back in 2005 and has been providing programming support, consulting, training and evangelism to external developers. He started his career in Budapest, then worked in Prague for 3 years and now lives in South England, UK. At the moment focusing on Inventor and Fusion 360, plus cloud and mobile related technologies. Adam has a degree in Software Engineering and has...