Getting the user and groups associated with a user

Hello,

I am new to okta. I was wondering if there is a way to obtain user group details without supplying an API key in the authorization?

You need to complete some form of authorization to get that information. One option is, as you saw, hitting the /users/$userId/groups endpoint.

Another is, if you are working on an OIDC application, storing that information within the tokens issued to a user, more details in this guide: Customize tokens returned from Okta with a Groups claim | Okta Developer

Note that SAML apps also have a similar functionality, but its configuration is different: How to pass a user’s group membership in a SAML Assertion from Okta? | Okta Help Center