I have created the Spring boot Rest API and authenticating using Google OAuth2.
I am testing GET API using browser it is working fine. However, I need to test POST api, i am using POSTMAN and getting unwired HTML response.
pom.xml -------- included dependency.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-oauth2-client</artifactId>
</dependency>
Created Config-------------
public class OAuthConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(HttpSecurity http) throws Exception {
http.csrf().disable().antMatcher("/**")
.authorizeRequests()
.antMatchers("/")
.permitAll()
.anyRequest()
.authenticated().and().oauth2Login().and().oauth2Client();
}
}
=========================
@GetMapping(value = "/hello", produces = "application/json")
public Principal getHello(Principal principal) {
return principal;
}
This rest point is working fine with browser after authenticating using gmail user and password. Principal render the JOSN object on Browser. after hitting url http:localhost:8081/hello "idToken":{ "tokenValue": However, It is not working with POSTMAN.
Please someone help me to test POST API using POSTMAN.