Autodesk-Forge / forge-api-nodejs-client

Forge Node.js SDK: Provides Node.js SDK to help you easily integrate Forge REST APIs into the application
Apache License 2.0
124 stars 86 forks source link

Where to "run the following code" #6

Closed SelaOAL closed 7 years ago

SelaOAL commented 7 years ago

It says in the readme to "run the following code" for the 2-legged and 3-legged tokens, but where this code is supposed to be placed? I couldn't even find in any of the files 'CLIENT_ID'.

Edit: So I placed the 2/3-legged code in a file and ran it with node, in the 3-legged oAuth2ThreeLegged.generateAuthUrl(); doesn't return authorizationCode in the url, and if I try to navigate to that url, I get:

{"developerMessage":"The required parameter(s) redirect_uri not present in the request","userMessage":"","errorCode":"AUTH-008","more info":"http://developer.api.autodesk.com/documentation/v1/errors/AUTH-008"}

gregra81 commented 7 years ago

Hi, Did you initialize the oAuth2ThreeLegged object like so: var oAuth2ThreeLegged = new ForgeSDK.AuthClientThreeLegged(CLIENT_ID, CLIENT_SECRET, REDIRECT_URL, [ 'data:read', 'data:write' ]);

Mind the CLIENT_ID, CLIENT_SECRET, REDIRECT_URL - you need to set them properly

SelaOAL commented 7 years ago

I didn't set the REDIRECT_URL, now it worked.

gregra81 commented 7 years ago

Great!