-
Notifications
You must be signed in to change notification settings - Fork 317
Open
Description
Checklist
- I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- I have looked into the API documentation and have not found a suitable solution or answer.
- I have searched the issues and have not found a suitable solution or answer.
- I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- I agree to the terms within the Auth0 Code of Conduct.
Describe the problem you'd like to have solved
Overview
When our team upgraded to v5 of auth0 js library, we found that there was no way to get a members role. Instead we needed to list the roles and user_id's of all of the organizations members to be able to get the roles.
For example this is the code we have to support getting a users roles who is apart of an organization.
export const getAuth0UserRoles = async (auth0OrgId: string, auth0UserId: string): Promise<Management.OrganizationMemberRole | undefined> => {
const response = await auth0Management.organizations.members.list(auth0OrgId, {
fields: 'roles,user_id',
include_fields: true,
});
return response.data.filter((member) => member.user_id === ensureAuth0Prefix(auth0UserId))?.[0];
};However, the v4 client had the ability to do this directly, so I've maintained a legacy management client as well.
export const legacyGetAuth0UserRoles = async (
auth0OrgId: string,
auth0UserId: string
): Promise<GetOrganizationMemberRoles200ResponseOneOfInner[]> => {
const response = await legacyAuth0Management.organizations.getMemberRoles({
id: auth0OrgId,
user_id: ensureAuth0Prefix(auth0UserId),
});
return response.data;
};We put roles on our organization members.
Describe the ideal solution
It would be awesome if we could get a get function when getting a member from an organization. Something like:
await auth0Management.organizations.members.get(auth0OrgId, ensureAuth0Prefix(auth0UserId), {
fields: 'roles,user_id',
include_fields: true,
});Alternatives and current workarounds
I listed this before, but the work around right now is to use the legacy client. However, it would be nice to drop the old legacy code.
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels