List a user's groups through SDK or browser library?

Through the raw API there is a way to get the groups a user belongs to via api/v1/users/<userid>/groups. I can’t seem to be able to do the same through the nodejs SDK or the browser js library. Am I missing something or is not possible?

Isn’t user.listGroups() the thing you are looking for?

Possibly! I could find that method anywhere in the docs. Will give it a try, thanks!

Hey @phi1ipp I tried your suggestion and kept getting the following error:

Unhandled Rejection (TypeError): usr.listGroups is not a function

Hey @phi1ipp perhaps would be more useful if I explain what I’m trying to accomplish and you can provide me pointers.

We have an app we’re considering using Okta for OIDC. Our customers in Okta would need to alter their group schema to add custom fields. Then upon logging into our system (through Okta OIDC) we would need to retrieve the groups the user belongs to and then interrogate those groups for custom metadata.

What would be best practices around this?

@rdodev,

Don’t mean to be rude or ignorant, but where is your problem? What exactly does not work?

@phi1ipp getting group custom metadata either in the jwt token or how to get that group metadata with okta client library. Not seeing how that’s possible unless the user provides us (the app) with an API key.

It’s bit misleading compared to the topic of this thread… Yeah, I’m not aware of any other way around having API token (SSWS or Bearer possibly)

@phi1ipp yeah thought so. Tried using those SSWS and Bearer but as expected didn’t work. Those are generated to federate access to resources in the app, not to hit the Okta API. Thanks for confirming.