Alexander Shorey
Alexander Shorey

Reputation: 21

autodesk-forge doesn't accept cURL request scope

Having trouble getting an initial Access Token for Forge, It looks like I'm following the tutorial to a T, but no luck.

https://developer.autodesk.com/en/docs/oauth/v2/reference/http/authenticate-POST/

I'm running curl on windows via Cygwin.

curl -v 'https://developer.api.autodesk.com/authentication/v1/authenticate' -X 'POST' -H 'Content_Type: application/x-www-form-urlencoded' -d 'client_id=000000000000000000000000000000000&client_secret=0000000000000000&grant_type=client_credentials&scope=data:read'

What I get back is...

< HTTP/1.1 400 Bad Request
< Content-Type: application/json
< Date: Mon, 13 Mar 2017 03:50:00 GMT
* Server Apigee Router is not blacklisted
< Server: Apigee Router
< Content-Length: 210
< Connection: keep-alive
<
* STATE: PERFORM => DONE handle 0x600057680; line 1981 (connection #0)
* multi_done
* Curl_http_done: called premature == 0
* Connection #0 to host developer.api.autodesk.com left intact
{"developerMessage":"Requested scopes must be blank or a subset of the provided scopes.","userMessage":"","errorCode":"AUTH-004","more info":"http://developer.api.autodesk.com/documentation/v1/errors/AUTH-004"}

Not sure what's going on. Is my requested scope actually wrong?

Upvotes: 1

Views: 528

Answers (2)

Alexander Shorey
Alexander Shorey

Reputation: 21

JQ will certainly make things more pleasant moving forward.

It turns out my problem was the encoding of the shell script I was writing the command into was dos. Setting it to Unix allowed my args to be interpreted correctly.

Upvotes: 1

Jaime Rosales
Jaime Rosales

Reputation: 1288

You can check the steps I have setup in this post which also gets a 2legged authentication token through cURL. I have tested both scenarios with OSX terminal and Windows Cygwin.

https://forge.autodesk.com/blog/tutorial-using-curl-2-legged-authentication-model-translation

Upvotes: 0

Related Questions