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

Bluesky: store access/refresh tokens instead of creating a new session on every request #1584

Closed
snarfed opened this issue Oct 26, 2023 · 6 comments

Comments

@snarfed
Copy link
Owner

snarfed commented Oct 26, 2023

Lol. My user page https://brid.gy/bluesky/did:plc:fdme4gb7mu7zrie7peay7tst currently shows HTTP Error 429: {"error":"RateLimitExceeded","message":"Rate Limit Exceeded"} because we log in (ie call createSession) with username and app password on every request instead of storing the access token and using it in subsequent sessions. Funny.

cc @JoelOtter. Hopefully not too hard to fix. And not that urgent, I think the rate limit is per user, and I expect I hit it because I was running discover on a bunch of my old posts.

@snarfed
Copy link
Owner Author

snarfed commented Oct 26, 2023

Hmm, I take it back, the rate limit might not be per user, I'm seeing it on other user pages too. Funny.

@JoelOtter
Copy link
Contributor

I just hit it too :/ Storing access tokens is kind of a pain because they're very short lived, do we have a notion of a cache with eviction times rather than putting it in the DB?

@snarfed
Copy link
Owner Author

snarfed commented Oct 27, 2023

Oh, we'd store and use the refresh token too. I think I see how we'd do this one, I'm happy to take it unless you disagree.

@JoelOtter
Copy link
Contributor

Please do! I'm interested to see what the problem actually ends up being here, I never once hit a rate limit locally and I was hammering it a lot harder than I did the real thing

@snarfed
Copy link
Owner Author

snarfed commented Oct 27, 2023

For posterity, the rate limit we're hitting is createSession 30/5 min, 300/day: https://atproto.com/blog/rate-limits-pds-v3 . They say it is per handle (ie user) after all.

snarfed added a commit to snarfed/lexrpc that referenced this issue Oct 27, 2023
snarfed added a commit to snarfed/oauth-dropins that referenced this issue Oct 28, 2023
snarfed added a commit that referenced this issue Oct 28, 2023
and let lexprc manage and refresh sessions. for #1584
@snarfed
Copy link
Owner Author

snarfed commented Oct 28, 2023

Done!

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

2 participants