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

How to get token refreshed #34

Closed
lizzha opened this issue Dec 5, 2016 · 3 comments · Fixed by #163
Closed

How to get token refreshed #34

lizzha opened this issue Dec 5, 2016 · 3 comments · Fixed by #163

Comments

@lizzha
Copy link

lizzha commented Dec 5, 2016

By default the token is valid for 10 minutes. How to get the token refreshed after it expires?

@srbry
Copy link
Contributor

srbry commented Dec 5, 2016

Hi @lizzha by default this client will use the oauth refresh tokens to get a new token automatically whenever a token has expired. This has the caveat of refresh tokens themselves actually having an expiry (something like a few days). In order to get a new token after that you would basically want to recreate the client to kick off the oauth process from the very start.

@altenhof
Copy link
Contributor

altenhof commented Mar 1, 2017

Hi,

we recently faced the same issue where the library failed to renew the refresh token.
It turned out that using a CF user/password for login will not work when it comes to renewing the refresh token. If that has to be refreshed the underlying oauth client will use the token_url which then requires a UAA client/secret, not a CF user/password.

Best

Michael

combor pushed a commit to alphagov/paas-metric-exporter that referenced this issue Mar 17, 2017
We’d like to prevent an issue covered here on go-cfclient github
project. [1]

In order to do that, we’re implementing an extra while loop, that will
wrap our existing logic and once it fails with a specific type of error,
it should run the authentication once again.

[1] cloudfoundry/go-cfclient#34
@drnic
Copy link
Contributor

drnic commented Aug 23, 2017

Is this an improvement that can be brought into this lib?

johnsonj added a commit to johnsonj/go-cfclient that referenced this issue 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 cloudfoundry#34
updates cloudfoundry-community/stackdriver-tools#177
lnguyen pushed a commit that referenced this issue Jan 5, 2018
* 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 #34
updates cloudfoundry-community/stackdriver-tools#177

* grab token expiration after successful fetch
MB175 pushed a commit to MB175/go-cfclient that referenced this issue 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 a pull request may close this issue.

4 participants