Created
May 28, 2022 12:07
-
-
Save ahndmal/5dcc086be87e2adbebbbb61e8b15cad5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class OAuth2LoginConfig { | |
@Bean | |
public ReactiveClientRegistrationRepository clientRegistrationRepository() { | |
return new InMemoryReactiveClientRegistrationRepository(this.googleClientRegistration()); | |
} | |
private ClientRegistration googleClientRegistration() { | |
return ClientRegistration.withRegistrationId("google") | |
.clientId("google-client-id") | |
.clientSecret("google-client-secret") | |
.clientAuthenticationMethod(ClientAuthenticationMethod.CLIENT_SECRET_BASIC) | |
.authorizationGrantType(AuthorizationGrantType.AUTHORIZATION_CODE) | |
.redirectUri("{baseUrl}/login/oauth2/code/{registrationId}") | |
.scope("openid", "profile", "email", "address", "phone") | |
.authorizationUri("https://accounts.google.com/o/oauth2/v2/auth") | |
.tokenUri("https://www.googleapis.com/oauth2/v4/token") | |
.userInfoUri("https://www.googleapis.com/oauth2/v3/userinfo") | |
.userNameAttributeName(IdTokenClaimNames.SUB) | |
.jwkSetUri("https://www.googleapis.com/oauth2/v3/certs") | |
.clientName("Google") | |
.build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment