I have this SpringBoot app, which uses the OAuth2 login via Google. And it works just fine on it's own.
However, I'm trying to connect it with my React frontend and thus: trying to develop the exchange of tokens.
SecurityConfig
http.cors()
.and()
.authorizeRequests()
.antMatchers(HttpMethod.GET, "/oauth/**")
.authenticated()
.anyRequest()
.permitAll()
.and()
.oauth2Login();
Now, I'm obtaining the token this way:
OAuth2AuthorizedClient client = authorizedClientService.loadAuthorizedClient(authentication.getAuthorizedClientRegistrationId(), authentication.getName());
String token = client.getAccessToken().getTokenValue();
and send it to my React client.
The question is: how to receive and interpret the authorization token at SpringBoot app?
Right now it's giving me a CORS issue as soon as I attach the Authoriation
header...