Я использую грант авторизации_кода, который обменивается на токен доступа, используя следующее конфигурация безопасности:
Код: Выделить всё
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.authorizeHttpRequests((authorize) -> authorize
.anyRequest().authenticated()
).oauth2Client(oauth2 -> oauth2
.authorizationCodeGrant(codeGrant -> codeGrant
.accessTokenResponseClient(new DefaultAuthorizationCodeTokenResponseClient())))
.formLogin(Customizer.withDefaults());
return http.build();
}
}
(Это пример, предоставленный поставщиком)
Код: Выделить всё
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"access_token":"2YotnFZFEjr1zCsicMWpAA",
"token_type":"Bearer",
"expires_in":3600,
"refresh_token":"tGzv3JOkF0XG5Qx2TlKWIA",
"refresh_expires_in": 7776000
"membership_id":"4352344"
}
Любая помощь будет очень признательна.
Подробнее здесь: https://stackoverflow.com/questions/787 ... ient-using