Skip to content

How to refresh expired access_token automatically when token relaying from zuul downstream inner microservices in spring cloud G? #6636

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

Closed
andyzhaozhao opened this issue Mar 22, 2019 · 1 comment

Comments

@andyzhaozhao
Copy link

andyzhaozhao commented Mar 22, 2019

Summary

I have written a sample https://github.com/andyzhaozhao/cloud-oauth2-jwt-sample
There are 4 models in the sample:

  • eureka:Eureka Server
  • zuul: as an Oauth2 client , zuul->resource,zuul->openfeign->resource
  • resource: normal microservice as a resource server
  • openfeign: as a resource server, openfeign->resource
  1. http://localhost:8080/dc . everything is right.
  2. http://localhost:8080/openfeign/dc . when the access_token is expired, a problem happened: the access_token is not refresh automatically ?

Actual Behavior

  1. register a client which the access_token_validity is 10sec and refresh_token_validity is 72000sec. so the access_token will expired quickly.
  2. visit http://localhost:8080/openfeign/dc from chrome browser.
  3. after 10sec then visit http://localhost:8080/openfeign/dc .There's a exception: 401
    @jgrandja
@jzheaux
Copy link
Contributor

jzheaux commented Apr 5, 2019

@andyzhaozhao Currently, Spring Security's refresh logic is embedded inside of a couple of ExchangeFilterFunctions that are handy for WebClients, as that was our first use case.

That said, the request to extract this logic is common, so it's something we'll likely be looking at.

In the meantime, no, OAuth2AuthorizeClientService doesn't refresh the token for you; you would need to do that yourself.

@jzheaux jzheaux closed this as completed Apr 5, 2019
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

No branches or pull requests

2 participants