Gquere
Gquere

Reputation: 1

Forge authentication failure while trying to get a token: error 404

I am trying to create a 2-legged authentication token for my forge app but I can't get anyone as I am told that the ressource doesn't exist . When I run this line in my Developer Command Prompt for VS 2019:

`curl -v "https://developer.api.autodesk.com/authentication/v1/authenticate"-X "POST"-H "Content-Type:application/x-www-form-urlencoded"-d "client_id=cRQTUv3rwWcqF00qn57W8ANNUIkV0wPo&client_secret=<edited-out>&grant_type=client_credentials&scope=data:read"`

I get the following message:

`< HTTP/1.1 404 Not Found
< Date: Fri, 17 Apr 2020 13:30:41 GMT
< Content-Type: application/json
< Content-Length: 205
< Connection: keep-alive
< Access-Control-Allow-Origin:
< Access-Control-Allow-Methods: POST,GET,OPTIONS,HEAD,PUT,DELETE,PATCH
< Access-Control-Allow-Headers: Content-Length,x-ads-ul-ctx-client-id,x-ads-ul-ctx-caller-span- 
id,Content-Range,Access-Control-Allow-Origin,Authorization,x-ads-test,x-ads-ul-ctx-oxygen-id,x-ads- 
acm-scopes,x-ads-ul-ctx-head-span-id,If-Match,x-ads-ul-ctx-source,Accept-Encoding,If-Modified- 
Since,x-ads-acm-namespace,Access-Control-Allow-Credentials,x-ads-acm-groups,Session-Id,Content- 
Encoding,x-ads-ul-ctx-scope,Range,Accept,x-ads-ul-ctx-workflow-id,x-requested-with,Expect,x-ads-acm- 
check-groups,If-None-Match,Content-Type,x-csrf-token
< Access-Control-Allow-Credentials: true
< Strict-Transport-Security: max-age=31536000; includeSubDomains
<
{ "developerMessage":"The requested resource does not exist.", "moreInfo": 
"https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/", "errorCode": 
"org.mozilla.javascript.Undefined@0"}* Connection #0 to host developer.api.autodesk.com left intact`

I have no ideas anymore. I was first following the Autodesk tutorial https://forge.autodesk.com/en/docs/oauth/v2/tutorials/get-2-legged-token/.

Upvotes: 0

Views: 469

Answers (1)

Petr Broz
Petr Broz

Reputation: 9909

The curl command seems malformed. All the different parameters should be separated by a whitespace, for example:

curl -v "https://developer.api.autodesk.com/authentication/v1/authenticate" -X "POST" -H "Content-Type:application/x-www-form-urlencoded" -d "client_id=cRQTUv3rwWcqF00qn57W8ANNUIkV0wPo&client_secret=<your-app-secret>&grant_type=client_credentials&scope=data:read"

Also, do not share your client app secret. Go back to your Forge app under https://forge.autodesk.com/myapps and generate a new client secret so that nobody can use the one you pasted here.

Upvotes: 1

Related Questions