yakovkhalinsky/backblaze-b2

Error getting bucket: Error: Request failed with status code 401

mattfranciswork0 opened this issue · 1 comments

Hi,
I'm trying to set up the library. However, I am receiving
Error getting bucket: Error: Request failed with status code 401

Steps on what I did

  1. Get my keyId and keyName from:

image



const b2 = new B2({
    applicationKeyId: "sadfasdffad", // or accountId: 'accountId'
    applicationKey: "masterApplicationKey", // or masterApplicationKey
});
  1. Create API method:
    Get bucketname from:
    image
 export const uploadCreationImage = async (
) => {
    try {
        await b2.authorize(); // must authorize first (authorization lasts 24 hrs)
        let response = await b2.getBucket({
            bucketName: "bobbyhill",
        });
        console.log(response.data);
    } catch (err) {
        console.log("Error getting bucket:", err);
    }
};

What is causing this issue?

Solved it. I was supposed to use the generated applicationKey (Mistook it as keyName) that only appeared once for applicationKey!