Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

...

Option 2 - Support all use cases except C2 and D2.

This option essentially restricts Bob to accepting the invitation with a Synapse account that is associated with the email address to which the invitation was sent.

Pros

  • Better user experience, as Bob will only need to validate his email address once.

Cons

  • Restricts Bob's choices.


The following content, colored in gray, is outdated.

Models to implement

EmailInvitationMembershipInvtnSignedToken

emailAddress

teamId


emailAddress

inviterId

teamId

hmac

Related models: AccountSetupInfoMembershipInvtnSubmission

Services to implement

ActionIntended UserURIMethodRequest ParametersRequest BodyResponse BodySuccess Response CodeNotification Sent to Notes
Send email invitation with link to join a teamteam administrator/emailInvitationPOST
EmailInvitation
200 OKEmail address providedThe invitation link will contain a serialized MembershipInvtnSignedToken
Create MembershipInvitation using a signed tokenauthorized user/tokenMembershipInvitation POSTinviteeIdMembershipInvtnSignedTokenMembershipInvtnSubmission201 Created
Similar to POST /membershipInvitation, but using a signed token for authorization. Also, doesn't send any email notifications.

Related services: POST /principal/availablePOST /accountPOST /sessionPOST /membershipInvitation

Example implementation with Synapse web client

As the use cases above, the inviter is Alice and the invitee is Bob.

  1. Alice invites Bob to her team by entering his email address.
  2. Web client constructs an EmailInvitation using Bob's email address and Alice's team's id, then uses it to send a POST /emailInvitation request to the backend.
  3. Backend constructs a signed MembershipInvtnSignedToken with Bob's email address, Alice's team's id and Alice's id.
  4. Backend serializes the MembershipInvtnSignedToken, embeds it into an invitation link to the web client and sends the link to Bob's email address.
  5. Bob clicks on the link and does one of the following:
    1. Registers a new Synapse account.
      1. Web client constructs an AccountSetupInfo [1], then uses it to create Bob's account through POST /account and receives a session token.
    2. Signs in to his existing Synapse account.
      1. Web client retrieves a session token through POST /session.
  6. Web client deserializes and validates the MembershipInvtnSignedToken in the link and extracts the inviteeId out of Bob's session token, then sends a POST /tokenMembershipInvitation request to the backend.
  7. Backend validates the MembershipInvtnSignedToken and inviteeId and creates a MembershipInvitation from Alice's team to Bob's account.
  8. Web client receives backend's 201 response, then directs Bob to his profile's Team tab, where he has a pending MembershipInvitation to Alice's team
  9. Bob accepts Alice's invitation (using the existing MembershipInvitation services).

Anchor
1
1
[1] Note that the web client needs to construct a valid emailValidationToken, making up a timestamp in the process.

Alternative implementations


DescriptionProsCons
1

POST /emailInvitation and POST /tokenMembershipInvitation

(Proposal described above)

+ Supports most use cases (all but B)

+ Simple -> less development time

- Not RESTful
2

Same as option 1, but store EmailInvitation in the database and implement REST methods for it.

I.e. GET /emailInvitation, GET /emailInvitation/{id}, DELETE /emailInvitation/{id}, etc.

+ Supports use case B

+ RESTful

- More complex -> more development time
3

User precursor

+ Supports use case B

+ More easily extensible (future support for operations other than inviting to a team)

+ RESTful

- Even more complex -> more development time

- ACL management is out of scope