Product Memberships

If your product is a B2C product, you won't have teams - you'll just have memberships directly for the product.

List product memberships

const memberships = await cio.ListMemberships();

The returned membership object containers user data for the member.

Get membership by membership ID, user ID, or user email

const membership = await cio.GetMembershipById(membershipId);
const membership = await cio.GetMembershipByUserId(userId);
const membership = await cio.GetMembershipByUserEmail(userEmail);

Update membership

await cio.UpdateMembership(membershipId, { access_level, scopes, data });

Remove member from product

await cio.DeregisterMember(membershipId);

Signup a new member

To signup a member, you must have a user signup token which is created using the POST /u/memberships route. Pass the token into this function:

const membership = await cio.SignupMember(token);

Invite a new member

You can also invite a member. This is similar to inviting a member on a team but you call it from the cio object.

const invitation = await cio.Invite(email, access_level='member', scopes=[], data={}, redirect_uri);

The invite method sends an invitation email to the user to join the product. You can optionally pass the user data object to store for the user.

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.