Get group information of user from APIController

I am developing an app for nextcloud for allowing JWT authentication for firebase custom login. Currently everything is working fine but i need to get the groups of the users. I am using APIController to get the authentication and jwt token. I can get user displayname, email etc but i need the groups list to filter the users actions on the external firebase app.
Would be nice if someone can shed some light on it

Thanks in advance

You can use \OCP\IGroupManager::getUserGroups if you have the \OCP\IGroupManager injected via the constructor.