Questions tagged [oauth2resttemplate]
26 questions
10
votes
3 answers
Using .p12 file to execute request to rest server
I'm trying to execute requests to a server which provided me with a .p12 file in order to make secure connection with rest services, I'm doing the following in order to set the HttpClient with the key:
SSLContext sslContext =SSLContextBuilder
…

DuSant
- 970
- 12
- 25
8
votes
1 answer
Cache acces token using Spring Oauth2
I have implemented REST web services in java spring framework. My application needs to acquire an Access Token in order to in order to make other URL requests. I would like to cache the token so I can reuse it until it expires. For now, I'm using a…

ortizbje
- 138
- 2
- 7
5
votes
0 answers
OAuth2RestTemplate and handling of expired tokens
We have been using Spring Oauth2 rest template and has been working well.
Can someone please clarify on what the recommendations are for handling expired bearer tokens.
The OAuth 2 spec states that the consumer should return 401 with error =…

myspri
- 283
- 7
- 14
3
votes
1 answer
How to configure multiple OAuth2RestTemplates for different services?
How can I configure multiple OAuth2RestTemplates (via OAuth2ProtectedResourceDetails) using Spring Boot so that I can access multiple APIs. They are all configured in same tenant as we see with all configuration being the same except for the…

Eric Winter
- 960
- 1
- 8
- 17
2
votes
1 answer
Spring RestTemplate with JDK11 errors Posting data above certain limit
I am using OAuth2RestTemplate with JDK11 to make a POST request with Json data (860 lines and 26 KB). Strangely the code works fine with < 700 Json lines (or 20 KB) on production server and with < 500 lines (15 KB) on local machine. But as soon I…

Jogger
- 397
- 5
- 15
2
votes
1 answer
OAuth2RestOperations uses token obtained from request header instead of requesting the auth server
I have a spring boot client app which uses OAuth2RestTemplate as OAuth2Client. I have configured the OAuth2RestTemplate to call authserver and add token obtained from it to header for accessing resource server.
The problem occured is that whenever i…

Sudan Shrestha
- 97
- 1
- 10
2
votes
1 answer
CertificateException: No name matching localhost found using OAuth2RestTemplate NOT RestTemplate
I am trying to use a OAuth2RestTemplate to access a self-signed certificate to retrieve tokens over HTTPS but I am still getting this error:
javax.net.ssl.SSLHandshakeException:
java.security.cert.CertificateException: No name matching localhost
…

Mick Knutson
- 2,297
- 3
- 25
- 48
1
vote
0 answers
oAuth2RestTemplate.exchange function returns 400 error response as the endpoint server doesn't send response within specific time
When i make call to endpoint url, as the response from endpoint application takes more time, it gives 400 error response.How to increase the wait time in STS to receive the correct response from endpoint.Is there any configuration that increases the…

user3778500
- 11
- 1
1
vote
1 answer
Spring Resource Server with OAuth2 to relay access token
I have a Spring Boot Resource Server protected with OAuth2 (KeyCloak). I can access endpoints with Bearer Token. Now, I want to call another service protected by the Auth Server. I would like to relay the token. I could not find a clear guide as to…

ranpa
- 11
- 2
1
vote
0 answers
Spring boot OAuth2RestTemplate client setup, authorization_request_not_found error
I try to setup an OAuth2RestTemplate in a spring boot project. I tried to follow a custom setup, but for some reason I always get authorization_request_not_found error when trying to access a secured resource.
My…

Tozo
- 63
- 7
1
vote
0 answers
OAuth2 Client should send custom parameters
I'm using spring-security-oauth2-2.2.0 in a spring mvc application. I have my oauth2 token configured with OAuth2RestTemplate like this:
ClientCredentialsResourceDetails resourceDetails = new ClientCredentialsResourceDetails();
…

Magui87
- 173
- 3
- 9
1
vote
1 answer
What is the 'error="access_denied", error_description="Error requesting access token."' when creating OAuth2RestTemplate
I need help with the error when trying to access the oAuth2 token using OAuth2RestTemplate
My java code is provided below.
I am using Spring version 4.3.4 and Spring Security oAuth version 2.3.4
Thank you!
ClientCredentialsResourceDetails…

Sanjay Sharma
- 11
- 2
0
votes
0 answers
Micro Services - Scope 'session' is not active for the current thread; IllegalStateException: No thread-bound request found
First of all I went through all the posts(such as [https://stackoverflow.com/questions/21286675/scope-session-is-not-active-for-the-current-thread-illegalstateexception-no][1] ) related to above topic in Stack overflow and couldn't find a solution…

sushi
- 139
- 1
- 9
0
votes
1 answer
Java - OAuth 2 using restTemplate to get login with refresh token (StackOverFlowError)
I created an interceptor to get the token before i do other request but i have the error "Method threw 'java.lang.StackOverflowError' exception." when i do the request.
public ClientHttpResponse intercept(HttpRequest request, byte[] body,
…

Tom
- 11
- 4
0
votes
1 answer
Oauth2Restclient spring example - without springBoot
I am looking for a simple OAuth2restClient example (without SpringBOOT)
I am trying with:
ClientCredentialsResourceDetails resource = new ClientCredentialsResourceDetails();
resource.setAccessTokenUri(…

Phil
- 1