Я пытаюсь использовать Spring Boot OAuth для авторизации в моем приложении через Zoom (https://marketplace.zoom.us/docs/guides/auth/oauth)
Я пытаюсь открыть страницу (/zoom
конечная точка) мое приложение перенаправляет меня в Zoom. Здесь я вхожу в учетную запись масштабирования, и Spring перенаправляет меня на страницу с ошибкой:
[missing_user_name_attribute] Missing required "user name" attribute name in UserInfoEndpoint for Client Registration: zoom
Не знаю, как с этим бороться. Вот мой код
Config
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/", "/login**", "/error**").permitAll()
.anyRequest().authenticated()
.and().logout().logoutUrl("/logout").logoutSuccessUrl("/")
.and().oauth2Login();
}
@Bean
public ClientRegistrationRepository clientRegistrationRepository() {
List<ClientRegistration> registrations = new ArrayList<>();
registrations.add(zoomClientRegistration());
return new InMemoryClientRegistrationRepository(registrations);
}
private ClientRegistration zoomClientRegistration() {
return ClientRegistration.withRegistrationId("zoom")
.clientId(/**myClientId**/)
.clientSecret(/**{myClientSecret}**/)
.clientAuthenticationMethod(ClientAuthenticationMethod.BASIC)
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE)
.redirectUriTemplate("{baseUrl}/login/oauth2/code/{registrationId}")
.authorizationUri("https://zoom.us/oauth/authorize")
.tokenUri("https://zoom.us/oauth/token")
.userInfoUri("https://api.zoom.us/v2/user")
.clientName("Zoom").build();
}
}
В приложении Zoom я настроил
URL-адрес перенаправления для OAuth: http://{my_host_name}/login/oauth2/code/zoom
URL-адреса в белом списке: http://{my_host_name}/zoom
Также мое приложение имеет конечную точку /zoom