Skip to content

b2sdk with InMemoryAccountInfo not successfully reauthenticating after authorizationToken expires #509

@anderoonies

Description

@anderoonies

I'm using https://github.com/ehossack/django-backblaze-b2 as a storage backend, which uses b2sdk to store files in a backblaze bucket.

Around 24 hours after deployment, I see frequent errors:
unauthorized for application key with capabilities 'readFiles,listBuckets,shareFiles,listFiles,readBuckets,writeFiles,deleteFiles', restricted to bucket <bucket-name>. My understanding is the authorizationToken has expired and isn't being refreshed.

django-backblaze-b2 instantiates a B2Api, authorizes the account, then doesn't interact with the authentication lifecycle at all, leaving that up to b2sdk. I believe these errors are related to b2sdk, and not django-backblaze-b2.

With these errors, I see the following two requests:

POST https://api.backblazeb2.com/b2api/v2/b2_authorize_account 200
HEAD https://<realm>/file/<path> 401

This leads me to believe that the _reauthorization_loop method is running to attempt to update the authorizationToken, then failing.

Unfortunately I can't replicate this in an environment where I can step through the error, since it requires waiting 24 hours for the authorizationToken to expire.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions