Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache the Authorization request/response to not get rate limited #20

Open
OscarEriksen opened this issue Mar 2, 2018 · 6 comments
Open

Comments

@OscarEriksen
Copy link

Backblaze API requires you to cache this in order to not get rate limited.

Will hopefully be able to provide you with a PR.

@alanmatty
Copy link

I'm having the same issue, need to reauthenticate every 24 hours. Getting: "Received error from B2: Authorization token has expired"

@iammichiel
Copy link

Caching that token requires an external storage system. One could implement this using an interface CacheProvider that could be injected by the user.

However, the system is a bit more complex in fact. You have both upload tokens, api tokens and download tokens. Each of those is independant and has it's own validity. And you cannot have more than 10 simultaneous upload tokens. Quite a bit restrictions in fact making a cache system quite complex...

@philhagen
Copy link

Receiving massive PHP Fatal error: Uncaught ChrisWhite\\B2\\Exceptions\\B2Exception: Received error from B2: 20 calls/minute allowed for: API_AUTHORIZE_ACCOUNT_CALLED error messages via the ILAB MediaCloud plugin. I suspect this is related.

@OscarEriksen
Copy link
Author

@philhagen This is absolutely related. I "fixed" this by caching it. But as @iammichiel says it's more complex and apparently there are many different types of tokens and so on; perhaps one of the reasons I'm actually experiencing weird behaviour even in production.

I feel a fork would be needed, or new maintainers. I'd be happy to help as long as someone would join me in it as I can't do it by myself (time, etc etc).

@Wouter33
Copy link

I created a pull request #22 which allows caching by extracting and inserting the authorization object/token. As far as i can see from the B2 API docs the authorizationToken is the only token which expires after 24 hours.

@tarikozket
Copy link

I forked the repo and merging the PRs in there. You can access it here: https://github.com/tarikozket/b2-sdk-php

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

No branches or pull requests

6 participants