Skip to content

Use b2_authorize_account allowed bucketId as default#85

Open
Klowner wants to merge 1 commit into
yakovkhalinsky:masterfrom
Klowner:use-auth-bucketid-as-default
Open

Use b2_authorize_account allowed bucketId as default#85
Klowner wants to merge 1 commit into
yakovkhalinsky:masterfrom
Klowner:use-auth-bucketid-as-default

Conversation

@Klowner

@Klowner Klowner commented Nov 24, 2019

Copy link
Copy Markdown
Contributor

Looks like #63 hasn't been touched in a few months, seems like a nice feature to have!

@cbess

cbess commented Nov 24, 2019

Copy link
Copy Markdown
Collaborator

If you provide/update test coverage for this feature, I'd be on board with the changes.

@Klowner

Klowner commented Nov 24, 2019

Copy link
Copy Markdown
Contributor Author

Would you prefer the individual tests be added to each of the API test groups or would a new test suite that just verifies that defaultBucketId is properly merged into all outgoing request bodies as bucketId (when bucketId / bucketName are omitted from options)?

@odensc

odensc commented Dec 10, 2019

Copy link
Copy Markdown
Contributor

The latter is fine.

@adrw

adrw commented Mar 28, 2020

Copy link
Copy Markdown

@Klowner Any chance this can be merged soon? Looks like a great optimization!

@Klowner

Klowner commented Apr 8, 2020

Copy link
Copy Markdown
Contributor Author

@adrw feel like writing some tests? :)

@ADumaine

ADumaine commented Feb 1, 2022

Copy link
Copy Markdown

This has been sitting here over 2 years. When will this be merged?

Having the associated bucketId also helps determine whether a master key or an application key has been used since a master key does not have an association with an individual bucket but an application key can.

For now I'll have to look for another package.

@ADumaine

Copy link
Copy Markdown

I ended up patching lib/utils.js to get this functionality. I also added bucketName since it is required by downloadFileByName

+  if (authResponse.allowed) {
+        context.defaultBucketId = authResponse.allowed.bucketId || '';
+        context.defaultBucketName = authResponse.allowed.bucketName || '';
+    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants