Failed to connect: 401 - unauthorised


I’m trying to create a backup to B2 for just my laptop. I currently have a backup going from my desktop computer to B2 that has no issues but when I created a new B2 bucket and test the connection to it (all other details are the same as my working desktop backup) I get the error in the title on my laptop.

I know my B2 account ID and applicaiton ID are correct as they are the exact same that I am using for my desktop backups.

This error is the same if I try to use my desktop bucket (but in a folder) as well.

I’ve searched for solutions to this but there are very few people experiencing this problem it seems. Does anyone have any ideas?

Hello @Froggo and welcome to the forum!

Nothing definite, but some ideas are below.

What OS are the computers? If something other than Windows, people sometimes see Mono do weird things.

You could try the job’s “Commandline” option and eye the “Target URL” box closely. This is a step closer to a backup than the original entry screen. You can also check options more easily because it’s all on one screen.

If you like, you could try backup from web UI Commandline, or even export the job for cmd.exe CommandLine.

I was originally thinking this might be an Application Key (versus Master Key) issue, but one test indicates no.

Is the 401 error happening immediately after the “Test connection” or on a later step such as folder creation?

Hi, thank you.

Both computers are Windows 10 and I’ve tried using a new application key in B2 but it didn’t change anything. The 401 error happens a few seconds after hitting ‘Test Connection’.

Thanks for clarifying. Possibly that will help narrow the issue, as the 401 I could get happened at a later step.

Returning to ideas and things to try:

See if the desktop can get to the new bucket.

Are the PCs similarly configured, e.g. Duplicati run in similar ways, antivirus similar, and network path similar?

Try a reboot of course.

See if some other B2-capable software works (or does NOT work). There’s quite a long list of B2 Integrations.

Duplicati users sometimes use rclone, for example to clone the backup, or migrate it to a different destination.

Duplicati even has an rclone backend, so you can probably see if it can do any better getting to B2 indirectly.

Try the previously mentioned Advanced --> Commandline and Configuration --> Export --> As Command-line. Docs » Manual » Using Duplicati from the Command Line might be useful if you’re not used to going that way.

This 401 error occurs when it lacks valid authentication credentials for the resource it is targeting. For example, you can go to hp customer support and look for the various error information.

Backblaze B2 seems to extend the meaning of 401 somewhat from the standard definition. 401 Unauthorized. Unfortunately I’m not sure of an easy way to tell what B2 API call failed. “Test connection” would require a few.

The B2 backend doesn’t have any helpful logging to enable. I see use (especially on GitHub) of “network.log” setup to capture unencrypted network traffic which then gets sanitized and sent to the right person somehow.

Attaching a debugger for a local debug session may help too, but again I’m not sure if that qualifies as easy…

This is the reason I’m hoping the problem can be isolated by changing other variables instead of direct attack.