Developer-Autodesk / viewer-javascript-tutorial

This library has now moved to https://github.com/Autodesk-Forge/viewer-nodejs-tutorial
https://github.com/Autodesk-Forge/viewer-nodejs-tutorial
MIT License
52 stars 59 forks source link

upload tutorial issues #8

Open ghost opened 7 years ago

ghost commented 7 years ago

I may well be missing something totally basic, but I'm having trouble with "Chapter 2" of the tutorial. I am unable to get either translating from client or translating on server to work. Even when I pull directly from the repo at v.1.0-workshop-client and supply my credentials (key + secret) in credentials.js, and then update the consumer key in upload.js (referring in this case to 2b translating on server) I get an error when I try to upload a file. It looks like this:

developer.api.autodesk.com/oss/v1/buckets:1 POST https://developer.api.autodesk.com/oss/v1/buckets 403 (Forbidden)
VM70:1 Uncaught SyntaxError: Unexpected token T in JSON at position 0
    at JSON.parse (<anonymous>)
    at XMLHttpRequest.xhr.onreadystatechange (Autodesk.ADN.Toolkit.ViewData.js:203)
xhr.onreadystatechange @ Autodesk.ADN.Toolkit.ViewData.js:203

Am I missing something? or has something changed since these tutorial files were created?

I'm a beginner with a lot of this so if I'm just being stupid I appreciate your patience :)

bigscorpions commented 7 years ago

You'd better post all your code here, especially the authentication code. I remember the tutorial or the api does have some minor problem because of the api changing.

shiya commented 7 years ago

You now need to add the scope to your tokens: https://developer.autodesk.com/en/docs/oauth/v2/tutorials/get-2-legged-token/

bigscorpions commented 7 years ago

I did have some problems with scope too. The tutorial is a little vague but I figure it out. This is my code and I have tested it before:

authReq.AddParameter("scope", "bucket:create bucket:read data:read data:write");