Error getting bucket: Error: Request failed with status code 401
mattfranciswork0 opened this issue · 1 comments
mattfranciswork0 commented
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
- Get my keyId and keyName from:
const b2 = new B2({
applicationKeyId: "sadfasdffad", // or accountId: 'accountId'
applicationKey: "masterApplicationKey", // or masterApplicationKey
});
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?
mattfranciswork0 commented
Solved it. I was supposed to use the generated applicationKey (Mistook it as keyName) that only appeared once for applicationKey!