connect
connect copied to clipboard
Support OAuth 2.0 with bootstrapped refresh token
In cases where a refresh token exists for an OAuth 2.0 server but the client credentials are invalid we could potentially support using the existing refresh token.
Taken from https://stackoverflow.com/questions/28685033/how-to-handle-refresh-tokens-in-golang-oauth2-client-lib :
var token oauth2.Token
token.AccessToken = {{ From config }}
token.RefreshToken = {{ From config }}
token.Expiry = {{ From config }}
token.TokenType = {{ From config }}
var conf oauth2.Config
// TODO: Build the endpoint similar to how the client credentials config does currently
return conf.Client(ctx, token)