I get an invalid auth token error, but that token is valid. It is the master application token.
❯ B2_APPLICATION_KEY_ID=42---- B2_APPLICATION_KEY=005a----- b2 bucket get scraped-hackathon-data
--snipped--
❯ b2 account authorize --verbose $B2_KEY_ID $B2_APPLICATION_KEY
INFO:b2._internal.console_tool:// ======================================== 4.3.1 ======================================== \\
DEBUG:b2._internal.console_tool:platform is Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.36
DEBUG:b2._internal.console_tool:Python version is CPython 3.12.9 (main, Feb 6 2025, 22:36:39) [GCC 12.2.0]
DEBUG:b2._internal.console_tool:b2sdk version is 2.7.0
DEBUG:b2._internal.console_tool:locale is ('C', 'UTF-8')
DEBUG:b2._internal.console_tool:filesystem encoding is utf-8
DEBUG:b2._internal.console_tool:default encoding is utf-8
DEBUG:b2._internal.console_tool:flags.utf8_mode is 0
DEBUG:b2sdk._internal.account_info.sqlite_account_info:calling SqliteAccountInfo._get_xdg_config_path(cls=<class 'b2sdk._internal.account_info.sqlite_account_info.SqliteAccountInfo'>)
DEBUG:b2sdk._internal.account_info.sqlite_account_info:SqliteAccountInfo file path to use: /home/lyton/.config/b2/account_info
DEBUG:b2sdk._internal.account_info.upload_url_pool:calling UploadUrlPool()
DEBUG:b2sdk._internal.account_info.upload_url_pool:calling UploadUrlPool()
DEBUG:b2sdk._internal.account_info.upload_url_pool:calling UploadUrlPool()
DEBUG:b2sdk._internal.account_info.upload_url_pool:calling UploadUrlPool()
DEBUG:b2sdk.v2.api:calling B2Session(account_info=<b2sdk._internal.account_info.sqlite_account_info.SqliteAccountInfo object at 0x7fc09dbca1e0>, cache=<b2sdk._internal.cache.AuthInfoCache object at 0x7fc09da80e90>, api_config=<b2sdk._internal.api_config.B2HttpApiConfig object at 0x7fc09da80440>)
DEBUG:b2sdk._internal.api:calling B2Session(account_info=<b2sdk._internal.account_info.sqlite_account_info.SqliteAccountInfo object at 0x7fc09dbca1e0>, cache=<b2sdk._internal.cache.AuthInfoCache object at 0x7fc09da80e90>, api_config=<b2sdk._internal.api_config.B2HttpApiConfig object at 0x7fc09da80440>)
DEBUG:b2sdk.v2.api:calling FileVersionFactory(api=<b2sdk.v2.api.B2Api object at 0x7fc09da80d70>)
DEBUG:b2sdk.v2.bucket:calling FileVersionFactory(api=<b2sdk.v2.api.B2Api object at 0x7fc09da80d70>)
DEBUG:b2sdk._internal.api:calling FileVersionFactory(api=<b2sdk.v2.api.B2Api object at 0x7fc09da80d70>)
DEBUG:b2sdk._internal.api:calling DownloadVersionFactory(api=<b2sdk.v2.api.B2Api object at 0x7fc09da80d70>)
DEBUG:b2sdk.v2.api:calling Services(api=<b2sdk.v2.api.B2Api object at 0x7fc09da80d70>, max_upload_workers=10, max_copy_workers=10, max_download_workers=None, save_to_buffer_size=None, check_download_hash=True, max_download_streams_per_file=None)
DEBUG:b2sdk._internal.api:calling Services(api=<b2sdk.v2.api.B2Api object at 0x7fc09da80d70>, max_upload_workers=10, max_copy_workers=10, max_download_workers=None, save_to_buffer_size=None, check_download_hash=True, max_download_streams_per_file=None)
DEBUG:b2sdk._internal.utils.thread_pool:calling LazyThreadPool(max_workers=10, kwargs=<class 'inspect._empty'>)
DEBUG:b2sdk._internal.utils.thread_pool:calling LazyThreadPool(max_workers=10, kwargs=<class 'inspect._empty'>)
DEBUG:b2sdk._internal.utils.thread_pool:calling LazyThreadPool(max_workers=None, kwargs=<class 'inspect._empty'>)
DEBUG:b2sdk._internal.transfer.inbound.download_manager:calling ParallelDownloader(min_part_size=104857600, max_streams=None, kwargs={'min_chunk_size': 8192, 'max_chunk_size': 1048576, 'align_factor': None, 'thread_pool': <b2sdk._internal.utils.thread_pool.LazyThreadPool object at 0x7fc09da812e0>, 'check_hash': True})
DEBUG:b2sdk._internal.transfer.inbound.download_manager:calling AbstractDownloader(thread_pool=<b2sdk._internal.utils.thread_pool.LazyThreadPool object at 0x7fc09da812e0>, force_chunk_size=None, min_chunk_size=8192, max_chunk_size=1048576, align_factor=None, check_hash=True, kwargs=<class 'inspect._empty'>)
INFO:b2._internal.console_tool:starting command [b2._internal.console_tool.AccountAuthorize] (arguments hidden)
Backblaze application key:
INFO:b2._internal.console_tool:Using https://api.backblazeb2.com
DEBUG:b2sdk.v2.api:calling B2Api.authorize_account(self=<b2sdk.v2.api.B2Api object at 0x7fc09da80d70>, realm='production') (hidden args: application_key_id, application_key)
DEBUG:b2sdk._internal.api:calling B2Api.authorize_account(self=<b2sdk.v2.api.B2Api object at 0x7fc09da80d70>, realm='production') (hidden args: application_key_id, application_key)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.backblazeb2.com:443
DEBUG:urllib3.connectionpool:https://api.backblazeb2.com:443 "POST /b2api/v2/b2_authorize_account HTTP/11" 401 64
DEBUG:b2sdk._internal.exception:calling interpret_b2_error(status=401, code='bad_auth_token', message='', response_headers={'Server': 'nginx', 'Date': 'Mon, 03 Mar 2025 23:46:45 GMT', 'Content-Type': 'application/json;charset=utf-8', 'Content-Length': '64', 'Connection': 'keep-alive', 'Cache-Control': 'max-age=0, no-cache, no-store', 'WWW-Authenticate': 'BASIC realm="authorize_account"', 'Strict-Transport-Security': 'max-age=63072000'}, post_params={})
ERROR:b2._internal.console_tool:ConsoleTool account authorization error
Traceback (most recent call last):
File "b2/_internal/console_tool.py", line 1366, in authorize
File "logfury/_logfury/trace_call.py", line 86, in wrapper
File "b2sdk/v2/api.py", line 54, in authorize_account
File "logfury/_logfury/trace_call.py", line 86, in wrapper
File "b2sdk/_internal/api.py", line 223, in authorize_account
File "b2sdk/_internal/session.py", line 116, in authorize_account
File "b2sdk/_internal/raw_api.py", line 537, in authorize_account
File "b2sdk/_internal/raw_api.py", line 528, in _post_json
File "b2sdk/_internal/b2http.py", line 395, in post_json_return_json
File "b2sdk/_internal/b2http.py", line 361, in post_content_return_json
File "b2sdk/_internal/b2http.py", line 314, in request_content_return_json
File "b2sdk/_internal/b2http.py", line 284, in request
File "b2sdk/_internal/b2http.py", line 595, in _translate_and_retry
File "b2sdk/v2/b2http.py", line 22, in _translate_errors
File "b2sdk/_internal/b2http.py", line 525, in _translate_errors
b2sdk._internal.exception.InvalidAuthToken: Invalid authorization token. Server said: (bad_auth_token)
ERROR: unable to authorize account: Invalid authorization token. Server said: (bad_auth_token)
INFO:b2._internal.console_tool:\\ ======================================== exit=1 ======================================== //
I get an invalid auth token error, but that token is valid. It is the master application token.
b2 version is
b2 command line tool, version 4.3.1I am running the tool on WSL, if that makes a difference.
The following works with the master key:
Running the took in verbose mode gives the following output
Running
❯ b2 account authorize --verbose $B2_KEY_ID $B2_APPLICATION_KEYeven asks me for the application key