NetStorageKit-Node icon indicating copy to clipboard operation
NetStorageKit-Node copied to clipboard

Got Not authorized when use dir function

Open slim-hmidi opened this issue 6 years ago • 1 comments

I'm trying to use the function dir:

const Netstorage = require('netstorageapi')

// Defaults: SSL: false
// By default no proxy is set
const config = {
hostname: "hostname",
keyName: "keyName",
key: "key",
cpCode: "cpCOde",
ssl: false,
}
// Don't expose KEY on your public repository.

const ns = new Netstorage(config)

ns.list('test', (err, response, body) => {
      if (err) {
        console.log('err: ', err)
      }
      console.log('body: ', body)
    })

Whatever the path I put (valid or not) I get the same message:

body:  { message: 'Not Authorized.' }

What's wrong?

slim-hmidi avatar Jul 01 '19 15:07 slim-hmidi

I ran in the same issue and adding to your ns.list path try this:

ns.list(`/${config.cpCode}/test`, (err, response, body) => {
      if (err) {
        console.log('err: ', err)
      }
      console.log('body: ', body)
    })

mick-feller avatar Sep 20 '19 15:09 mick-feller