Official tutorial: https://spring.io/guides/tutorials/spring-boot-oauth2/
Questions tagged [spring-oauth2]
708 questions
8
votes
2 answers
Spring Boot OAuth2 linking internal users with Facebook/Google login
I have implemented a Spring Boot application with AngularJS frontend. Have also setup users along with their permissions. Right now I am able to login with any of these users and is working well with Spring security. I would like to turn this…

bighi
- 247
- 3
- 13
8
votes
1 answer
Manual Configuration of OAuth2 Client using @EnableOAuth2Client not working
I am following this tutorial from the official spring docs to Manually Configure OAuth2 Client using @EnableOAuth2Client. For some reason it is not working. When I run the app and visit http://localhost:8080/login I see the basic form login instead…

varunkr
- 5,364
- 11
- 50
- 99
8
votes
2 answers
How to autowire this TokenStore
How do I trigger auto-logout of this sample Spring Boot OAuth2 app?
I tried adding the following code from an answer to this other posting into a new controller class in the demo package of the authserver app:
package demo;
import…

CodeMed
- 9,527
- 70
- 212
- 364
8
votes
2 answers
spring boot OAuth2 role based authorization
We have a dedicated authorization server extending AuthorizationServerConfigurerAdapter, where we have set authorities overriding void configure(ClientDetailsServiceConfigurer clients) method.
@Configuration
@EnableAuthorizationServer
…

pinaki
- 341
- 2
- 3
- 14
7
votes
2 answers
Migrate Spring Security configuration to Spring Cloud 2022.0.4
I want to migrate this Spring security configuration to latest Spring Cloud:
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.oauth2.resource.ResourceServerProperties;
import…

Peter Penzov
- 1,126
- 134
- 430
- 808
7
votes
1 answer
spring boot oauth ExceptionHandlerExceptionResolver : NestedServletException: nested exception is java.lang.StackOverflowError]
i created a authorization with spring boot oauth 2. I cannot get an access token with the data from database.
My AuthorizationServer:
@Configuration
@EnableAuthorizationServer
public class AuthorizationServerConfiguration extends…

emoleumassi
- 4,881
- 13
- 67
- 93
7
votes
2 answers
Provider ID must be specified for oauth2 client?
I am trying setting up a oauth2 client with spring-boot. I have this dependencies on my pom.xml:
org.springframework.boot
spring-boot-starter-oauth2-client
…

Kleber Mota
- 8,521
- 31
- 94
- 188
7
votes
1 answer
Spring Oauth2 Client, automatically refresh expired access_token
Let me explain my use case.
I need to have a spring boot oauth2 client application (not a resource server As we already have a separate resource server). Also I have following requirements:
For each out going request to resource server, we need to…

Agam
- 1,015
- 2
- 11
- 21
7
votes
2 answers
Spring Security HttpSecurity config
I try to understand how the RequestMatcher, AntMatcher and so on are working. I read some posts and understand the basics. Actually I have this simple basic config:
@Override
protected void configure(HttpSecurity http) throws Exception {
…

Patrick
- 12,336
- 15
- 73
- 115
7
votes
2 answers
Spring Boot + Security OAuth2.0 Client with Custom Provider
I am creating a OAuth2.0 client for a custom OAuth2 provider in Spring Boot + Security (version 5) application.
Below is the application.properties which has all the configuration and there is no additional configuration class in my…

Ankur Raiyani
- 1,509
- 5
- 21
- 49
7
votes
3 answers
How I can implement a custom authentication?
I have to integrate my system with third-party provider. This system is made with Spring and Angular.
Keep in mind that I need to create a custom login form instead redirecting to thirdy-party provider form like OAuth2.
He has created following…

Murillo Goulart
- 154
- 6
- 22
7
votes
2 answers
SpringSecurity WithSecurityContext MockMvc OAuth2 always unauthorised
I have followed the following links to try and test OAuth2 @PreAuthorise(hasAnyRole('ADMIN', 'TEST') for example but I can't any of the tests to pass or even authenticate.
When I try to access the end point with admin (or any role) it will never…

revilo
- 169
- 1
- 8
7
votes
1 answer
How does state get encoded or encrypted in Spring OAuth2?
How specifically is the state parameter related to the _csrf token in Spring OAuth2? Is state an encrypted version of _csrf as we would expect it to be?
Also, what specific Java syntax should be used to encode and encrypt a new _csrf value before…

CodeMed
- 9,527
- 70
- 212
- 364
6
votes
1 answer
How to get Refresh Token from Spring Authorization Server sample
The official sample Spring Authorization Server returns an access_token and id_token by default for Oauth 2.1 with PKCE
https://github.com/spring-projects/spring-authorization-server/tree/main/samples/default-authorizationserver
Is it possible that…

abbas
- 6,453
- 2
- 40
- 36
6
votes
1 answer
Unable to make the oauth2Login as stateless
I have provided the cookie based authorization request repository to oauth2Login() dsl to make it as stateless. but when I add the session creation policy as STATELESS , the oauth2 login is not working and returning "too many callbacks" error in UI…

Rajeev
- 183
- 2
- 10