Cofor.io manages team memberships for you. The Cofor.io user frontend allows team admins to invite new team members, and manage existing memberships. However, you can manage memberships through your product as well.
The Team Object
The following membership management functions require an instantiated Team object. You can get this from the authenticated login object
login.teamor by fetching a team by ID.See the Full SDK Reference for more information on the Team object.
List memberships of users on a team
const memberships = await team.ListMemberships();
The returned membership object contains user data for the member.
Get membership by membership ID, user ID, or user email
const membership = await team.GetMembershipById(membershipId);
const membership = await team.GetMembershipByUserId(userId);
const membership = await team.GetMembershipByUserEmail(userEmail);
Update membership
await team.UpdateMembership(membershipId, { access_level, scopes, data });
Remove user from team
await team.DeregisterMember(membershipId);
Invite user to team
const invitation = await team.Invite(email, access_level='member', scopes=[], data={}, redirect_uri);
The invite method sends an invitation email to the user to join the team. You can optionally pass the user data object to store for the user. If the user already exists in Cofor.io (maybe part of another team or product using Cofor.io), the user object is tied to the team. Else, a new blank user object is created and is tied to the team.
Make sure you set the redirect_uri to point to your front-end's login page that accepts a user authorization token after successful login.
