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

Upload rvt keep failing statusCode: 401, statusMessage: 'Unauthorized' #17

Closed kenken64 closed 7 years ago

kenken64 commented 7 years ago

Trying to upload an object

Uploading file. bucket:forge_sample_c6eaxriflqyzvmirmt306hsmawehv9ig filePath:D:/Project/bca-rvt/CCDC_HP_B4_ST_TYPICAL.rvt D:/Project/bca-rvt/CCDC_HP_B4_ST_TYPICAL.rvt buckets > [object Object] { statusCode: 401, statusMessage: 'Unauthorized' } Upload file response: undefined

fs.createReadStream(filePath).pipe(` request.put({ url:'https://developer.api.autodesk.com/oss/v2/buckets/'+bucketKey+'/objects/'+fileName, headers:{ 'Authorization':' Bearer ' + oAuth2TwoLegged.access_token }

        },function(err,response,body){
          if(err) {
            reject(null);
          }
          resolve(body);
        }));
kenken64 commented 7 years ago

var oAuth2TwoLegged = new ForgeSDK.AuthClientTwoLegged(CLIENT_ID, CLIENT_SECRET, [ 'data:read', 'data:write', 'bucket:read', 'bucket:update', 'bucket:create' ], autoRefresh);

kenken64 commented 7 years ago

/ 20170409045551 // https://developer.api.autodesk.com/oss/v2/buckets/forge_sample2_c6eaxriflqyzvmirmt306hsmawehv9ig/objects/CCDC_HP_B4_ST_TYPICAL.rvt

{ "reason": "No read access" }

kenken64 commented 7 years ago

Omg its not an upload issue.

Sorry is the createBucket