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

Respect expiration of password token source #163

Merged
merged 2 commits into from
Jan 5, 2018

Conversation

johnsonj
Copy link
Contributor

@johnsonj johnsonj commented Jan 5, 2018

When using username/password authentication the Client fetches a token on creation to be used as the token source. This token expires eventually and is only refreshable by creating a new Client object.

Capture the expiration of the token and refresh the oauth client when it expires.

fixes #34
updates cloudfoundry-community/stackdriver-tools#177

When using username/password authentication the Client fetches a token
on creation to be used as the token source. This token expires
eventually and is only refreshable by creating a new Client object.

Capture the expiration of the token and refresh the oauth client when it
expires.

fixes cloudfoundry#34
updates cloudfoundry-community/stackdriver-tools#177
@@ -168,7 +147,7 @@ func shallowDefaultTransport() *http.Transport {
}
}

func getUserAuth(ctx context.Context, config *Config, endpoint *Endpoint) (*Config, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not directly related- but I went ahead and made this pass by value. Passing by pointer allows the caller to modify the data. Passing/returning by value allow the caller to check the error result and accept (or decline) the config object based on the error.

@lnguyen lnguyen merged commit 2eadb63 into cloudfoundry:master Jan 5, 2018
MB175 pushed a commit to MB175/go-cfclient that referenced this pull request Aug 21, 2023
* Respect expiration of password token source

When using username/password authentication the Client fetches a token
on creation to be used as the token source. This token expires
eventually and is only refreshable by creating a new Client object.

Capture the expiration of the token and refresh the oauth client when it
expires.

fixes cloudfoundry#34
updates cloudfoundry-community/stackdriver-tools#177

* grab token expiration after successful fetch
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 this pull request may close these issues.

How to get token refreshed
2 participants