After working with a few more-or-less OAuth2 APIs lately, I would like to propose slightly extending the API footprint of the oauth2 library.
Most notably, it would be nice if OAuth2 could cater for the following situations:
- OAuth2 tokens with `expires_in` field (already handled by internal and in some of the OAuth2 providers)
- Add a `TokenRefresher` interface (currently implemented by `tokenRefresher`) that can be passed to a `ReuseTokenSource` for performing the actual token refresh to allow more flexible refresh scenarios.
With these two changes, x/oauth2 could be more widely used without need for reimplementation of the above parts plus might deduplicate parts of the implemented providers.
Hope the above points make sense, happy to take feedback.
Cheers,
Andi