maoberlehner / storyblok-migrate

Storyblok schema migrations
MIT License
30 stars 7 forks source link

`npx storyblok-component-export` 401 error response #8

Closed dsteinbach closed 4 years ago

dsteinbach commented 4 years ago

Getting this 401 error response when running: npx storyblok-component-export

Error: Request failed with status code 401
    at createError (/Users/dsteinbach@API.local/nuxt-storyblok/node_modules/axios/lib/core/createError.js:16:15)
    at settle (/Users/dsteinbach@API.local/nuxt-storyblok/node_modules/axios/lib/core/settle.js:17:12)
    at IncomingMessage.handleStreamEnd (/Users/dsteinbach@API.local/nuxt-storyblok/node_modules/axios/lib/adapters/http.js:236:11)
    at IncomingMessage.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1183:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  config: {
    url: '/spaces/12345/components',
    method: 'get',
    params: {},
    headers: {
      Accept: 'application/json, text/plain, */*',
      Authorization: 'abc123ABC456def789DEF',
      'User-Agent': 'axios/0.19.2'
    },
    proxy: false,
    baseURL: 'https://api.storyblok.com/v1',
    transformRequest: [ [Function: transformRequest] ],
    transformResponse: [ [Function: transformResponse] ],
    paramsSerializer: [Function: paramsSerializer],
    timeout: 0,
    adapter: [Function: httpAdapter],
    xsrfCookieName: 'XSRF-TOKEN',
    xsrfHeaderName: 'X-XSRF-TOKEN',
    maxContentLength: -1,
    validateStatus: [Function: validateStatus],
    data: undefined
  },

Environment:

node -v
v12.11.1

npm -v
6.11.3

Ive also tried node@8.16.2.

This is a public api token not a preview token (but both gave the same error). Ive installed storyblok-migrate locally and globally.

Thanks.

oytuntez commented 4 years ago

same here.

oytuntez commented 4 years ago

apparently we are supposed to use Management API tokens for this:

image

maoberlehner commented 4 years ago

See: https://github.com/maoberlehner/storyblok-migrate#configuration