Introspect call to Authorization server from Resource Server fails after second successive calls

Viewed 180

Introspect is failing after 2 successive attempts. Error : Introspect endpoint response was invalid,as content-type 'text/html' is not compatible with JSON at org.springframework.security.oauth.server.resource.authentication.OpaqueaTokenAuthenticationProvider.getOAuth2Authenticatedprincple

this is the sample code we are using:

@Override

protected void configure(HttpSecurity http) throws Exception {
    http
      .authorizeRequests(authz -> authz
        .antMatchers(HttpMethod.GET, "/bars/**").hasAuthority("SCOPE_read")
        .antMatchers(HttpMethod.POST, "/bars").hasAuthority("SCOPE_write")
        .anyRequest().authenticated())
      .oauth2ResourceServer(oauth2 -> oauth2
        .opaqueToken(token -> token.introspectionUri(this.introspectionUri)
          .introspectionClientCredentials(this.clientId, this.clientSecret)));
}
0 Answers
Related