Feign Client don't reauthentificate on expired refresh token Oauth2
See original GitHub issueHi,
I struggle with 401 errors, when refresh token expired. I would like to code a workflow to handle 401 codes and force reauthentification Oauth2 on feign client. How can I do this? This is microservice on Spring Boot 2.0.5 and Spring Cloud Security
Feign client version: 2.1.3.RELEASE
RequestInterceptor oauth2FeignRequestInterceptor() {
return new OAuth2FeignRequestInterceptor(new DefaultOAuth2ClientContext(), resource());
}
private OAuth2ProtectedResourceDetails resource() {
ResourceOwnerPasswordResourceDetails resourceDetails = new ResourceOwnerPasswordResourceDetails();
resourceDetails.setUsername(user);
resourceDetails.setPassword(password);
resourceDetails.setAccessTokenUri(accessTokenUri);
resourceDetails.setClientId(clientId);
resourceDetails.setClientSecret(clientSecret);
resourceDetails.setGrantType("all");
resourceDetails.setScope(Arrays.asList("all));
return resourceDetails;
}
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to provide an OAuth2 token to a Feign client using Spring ...
According documentation need use AuthorizedClientServiceOAuth2AuthorizedClientManager instead of DefaultOAuth2AuthorizedClientManager.
Read more >OAuth2 for a Spring REST API – Handle the Refresh Token in ...
We learned how to store the Refresh Token in an AngularJS client app, how to refresh an expired Access Token and how to...
Read more >What Are Refresh Tokens and How to Use Them Securely
This post will explore the concept of refresh tokens as defined by OAuth 2.0. We will learn how they compare to other token...
Read more >spring-projects/spring-security-oauth - Gitter
Then using this authorization code we get the Access Token. But Access Token ... no-store, max-age=0, must-revalidate], Pragma=[no-cache], Expires=[0], ...
Read more >Spring boot + Spring Security 5 + OAuth2/OIDC Client - Deep ...
Decoding magic behind spring boot oauth2 client. ... RestTemplate with a request interceptor that will refresh the tokens on expiry.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have just finished a hard solution. It just reset access token, when gets 401 and retry request. I hope my snippets will help somebody with similiar problem