<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z00007L6HyWCAVOkta Classic EngineAuthenticationAnswered2024-04-12T22:29:41.000Z2021-12-16T11:51:04.000Z2021-12-17T15:13:25.000Z

PradeepK.78700 (Customer) asked a question.

Getting unauthorized error when configured with userifo endpoint in my client application

I have configured the OAuth2 client application using Okta and working through the `Authorization_code` grant flow. The application is able to get the `auth code` and the token, but trying to hit the userinfo endpoint and getting a 401 error when I have specified the `user-info-uri`.

I have enabled debug for `org.springframework.security` package but not getting much details. Where am I going wrong?

Update: I am getting this error when I have the `user-info-uri` property in the configuration and if removed, the endpoint is accessible.

`application.yml`

```

server:

port: 8555

spring:

security:

oauth2:

client:

registration:

okta:

client-id: masked

client-secret: masked

provider:

okta:

authorization-uri: https://domain/oauth2/default/v1/authorize

token-uri: https://domain/oauth2/default/v1/token

user-info-uri: https://domain/oauth2/v1/userinfo

jwk-set-uri: https://domain/oauth2/default/v1/keys

 

debug: true

logging:

level:

org.springframework.security: debug

```

`ApplicationConfiguration.java`

```

@Configuration

public class ApplicationSecurityConfiguration extends WebSecurityConfigurerAdapter {

 

@Override

protected void configure(HttpSecurity http) throws Exception {

http.authorizeRequests()

.anyRequest()

.authenticated()

.and()

.oauth2Login();

}

}

 

```


  • ojovp (ojovp)

    Hello @pradeed kumar

    I hope you are having a great day 

     

    thank you for reach us to help you in this implementation, according to your scenario, the best way to proceed would be engage our support team using the link below so they can check the reasons for this problem and determine the best solution for your implementation.

     

    you can contact our support team, using the information found in the following link:

    https://support.okta.com/help/s/article/Mac-Devices-showing-as-unmanaged?language=en_US

     

    Have a great day ahead

    Regards

     

    Henry Esquivel 

    Okta Inc

     

     

    Expand Post
This question is closed.
Loading
Getting unauthorized error when configured with userifo endpoint in my client application