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

Proposal: create Account from refreshing oauth2.TokenSource #29

Open
andig opened this issue Nov 3, 2023 · 4 comments · May be fixed by #151
Open

Proposal: create Account from refreshing oauth2.TokenSource #29

andig opened this issue Nov 3, 2023 · 4 comments · May be fixed by #151

Comments

@andig
Copy link

andig commented Nov 3, 2023

Creating account from token string and saving tokens inside the account is brittle since tokens expire. Instead, create Account by passing either an oauth2.Token or oauth2.TokenSource.

Using #24, these tokens would then be refreshed.

@andig andig changed the title Proposal: create Account from oauth.TokenSource Proposal: create Account from refreshing oauth2.TokenSource Nov 3, 2023
@andig
Copy link
Author

andig commented Dec 22, 2023

@sethterashima can I ask you to look into this issue? Its still unclear how to create long-running applications to handle access token expiry. It seems the idiomatic way doing this would be using an oauth2.TokenSource which #24 suggest.
Is this on the roadmap or do you expect library consumers to use account.New() on token expiry?

@andig
Copy link
Author

andig commented Jan 24, 2024

Friendly ping. This is an absolut blocker for any long-running application. How are applications supposed to perform token refresh with the current capabilities?

@fabianhu
Copy link
Contributor

@andig
Hi, maybe have a look at my implementation .
I just check, if I have to refresh the access token right before using it.
If it is expired I do a token refresh with the refresh token.
Or do I not get the question?

@andig
Copy link
Author

andig commented Jan 27, 2024

I just check, if I have to refresh the access token right before using it.

@fabianhu that's exactly what a Golang TokenSource does and is implemented in #151. Point here is that the Account is presumably something long-lived. That is not possible if it works on a static token.

Imho this proposal is a more go-ish and fully-featured way of doing things.

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 a pull request may close this issue.

2 participants