fair-rose
fair-rose•3y ago

Error with API token

Hi I'm trying to save my data store to my api cloud account online so I'm using the forcecloud option. I have the APIFY_TOKEN environment variable set as one of my api keys, but I'm getting the following error message. Any help would be appreciated: CODE: const store = await Apify.openKeyValueStore('dataStore', { forceCloud: true}); ERROR: User was not found or authentication token is not valid ApifyApiError: User was not found or authentication token is not valid clientMethod: KeyValueStoreClient.get statusCode: 401 type: user-or-token-not-found attempt: 1 httpMethod: get path: /v2/key-value-stores/asd stack: at makeRequest (/Users/ek/src/WebstormProjects/salogin/node_modules/apify-client/src/http_client.ts:166:30) at processTicksAndRejections (node:internal/process/task_queues:96:5) at KeyValueStoreClient._get (/Users/ek/src/WebstormProjects/salogin/node_modules/apify-client/src/base/resource_client.ts:30:30) at StorageManager._getOrCreateStorage (/Users/ek/src/WebstormProjects/salogin/node_modules/apify/src/storages/storage_manager.js:125:33) at StorageManager.openStorage (/Users/ek/src/WebstormProjects/salogin/node_modules/apify/src/storages/storage_manager.js:67:35) at authorize (/Users/ek/src/WebstormProjects/salogin/index.js:224:19) at Object.googleSheetsAuthenticate (/Users/ek/src/WebstormProjects/salogin/index.js:267:22) at Object.<anonymous> (/Users/ek/src/WebstormProjects/salogin/index.test.js:51:38)
3 Replies
MEE6
MEE6•3y ago
@ECode just advanced to level 2! Thanks for your contributions! 🎉
Alexey Udovydchenko
Alexey Udovydchenko•3y ago
You should apify login https://docs.apify.com/cli/ then SDK will use token for logged apify user
fair-rose
fair-roseOP•2y ago
thanks that helped!

Did you find this page helpful?