How to convert spring boot app with Okta to read okta groups


A while back, I created a spring book application that uses Okta as the OIDC provider. It’s based on a previous version of this great example by Matt Raible:

Use React and Spring Boot to Build a Simple CRUD App

What I’m trying to do now is obtain the group or roles for the logged in user.

Based on Matt’s response on SO, I added the claims group in the admin interfaced and converted the app to the okta spring boot starter kit.

However, when I print the Authorities, I still don’t see the groups. The only authority I see is this:

Authority: ROLE_USER Username:

Heres the code which prints the authorities:

Collection<? extends GrantedAuthority> authorities = principal.getAuthorities();
for (GrantedAuthority authority : authorities) {
    System.out.println("Authority: " + authority.getAuthority());

Is there anything I’m doing wrong here?