CustomerID user invitation example

CustomerID user invitation example

In this article we show how to define user registration processes that are initialized with CustomerID API operations.

1. Create a user registration workflow

The registration workflow configuration defines user authentication, user verification, mandatory/optional/read-only user attributes, approvals and other registration details: Self-registration workflow configuration - CustomerID

Often the unique registration link within the invitation email act as user authentication and verification reliable enough for the use case, but additional strong authentication, like BankID, can be added when needed.

The registration workflow also defines the organization where the new users will be created: Self-registration workflow configuration - CustomerID | Self registrationworkflowconfiguration CustomerID registration.N.organizations

Typical organization definitions are

  • A global top-level organization for all users, e.g. “All Users”

  • A specific organization defined by using the user attributes

  • None, in which case the organization must be defined in another way, e.g. by using a role invitation

Configuration example:

registration.7 = confirm registration.7.logo.key = whitelabel_a registration.7.enabled=true registration.7.inviteonly = true registration.7.approval = false registration.7.organizations={ "path" : "customers/emea/${home_organization}" } registration.7.methods = [ { "name" : "password.2", "mandatory" : "true", "visible" : "false", "default" : "true" } ] registration.7.userinfo.fields = email, mobile, password registration.7.userinfo.disabled = email registration.7.summary.enabled = true registration.7.summary.fields = login, firstname, surname, mobile

2. Create an email template

The invitation emails are based on email templates that are defined in the configuration file mailmessages.properties (see Email text localization - CustomerID):

  • When defined, a workflow-specific email template, e.g. email.pendingUser.creation.confirm will be used

  • Otherwise, the template email.pendingUser.creation will used

Configuration example:

email.pendingUser.creation.confirm.enabled = true email.pendingUser.creation.confirm.subject = White Label Partner User invitation email.pendingUser.creation.confirm.message = \ <html>\ <body>\ <table valign="top" width="75%" cellspacing="0" cellpadding="0" border="0" align="center">\ <tbody>\ <tr><td>\ <a href="https://www.customer.com/"><img src="https://login.customer.com/uas/resource/logo_${user.partner}" height="75" alt="Customer"></a>\ </td></td>\ <tr><td>\ <br>\ </td></td>\ <tr bgcolor="#005EAE"><td>\ <h1><font color="white"> White Label Partner User Invitation</h1>\ </td></tr>\ <tr><td>\ <br>\ Dear ${user.firstname} ${user.surname},<br><br>\ Welcome to White Label Partner services, please sign up at the link below.<br>\ ${link}?returnurl=https%3A%2F%2Fwww.customer.com%2Flogin%2F<br><br>\ ${user.invite_info}\ Best regards,<br>\ White Label Partner Service Desk<br><br>\ NOTE: Do not reply to this message.<br>\ </td></tr>\ </tbody>\ </table>\ </body>\ </html>

3. Create a pending user

When the registration workflow and email template have been defined, user invitations can be created with the CustomerID API operation MOD026CreatePendingUser. Make sure that all read-only mandatory attributes are given as parameters for the API operation:

  • Attributes used in registration.N.organization

  • Read-only attributes defined in registration.N.userinfo.disabled

  • Attributes used as variables in the email template, like invite_info in the example above

Example:

curl -X POST "https://account.customer.com/customerid-rest/services/pendingusers?registration=confirm&firstname=Jack&surname=Smith&email=jsmith@gmail.com&home_organisation=white_label_a&invite_info=Example%20infotext" <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <idlist> <id>https://account.customer.com/customerid-rest/services/pendingusers/0e08429f-437a-4ac4-958d-a2066803f75c</id> </idlist>

4. Add role(s) to the pending user

It is possible to assign roles to pending users and registered users with the CustomerID API operation MOD025CreateRoleInvitation.

Example, please note the pending user ID from the previous example as a query parameter:

curl -X POST "https://account.customer.com/customerid-rest/services/roleinvitations?user=0e08429f-437a-4ac4-958d-a2066803f75c&role=customers/emea/white_label_partner_a/Admin" <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <idlist> <id>https://account.customer.com/customerid-rest/services/roleinvitation/7a974373-cc04-42c9-8368-b77301fdea41</id> </idlist> curl -X POST "https://account.customer.com/customerid-rest/services/roleinvitations?user=0e08429f-437a-4ac4-958d-a2066803f75c&role=customers/emea/white_label_partner_a/Retailer_View" <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <idlist> <id>https://account.customer.com/customerid-rest/services/roleinvitation/21a54f62-310b-4a1e-8f5f-03afbb824a82</id> </idlist>

5. User creates an account

Based on the MOD26 Create Pending User API operation, CustomerID sends an email invitation to the specified email address.

Example:

Dear Jack Smith, Welcome to White Label Partner services, please sign up at the link below. https://login.customer.com/eidm2/wf/register/confirm/6edf2475-651f-4dbd-a358-9fdbf7fda2dc?returnurl=https%3A%2F%2Fwww.customer.com%2Flogin%2F Example info from API Best regards, White Label Partner Service Desk NOTE: Do not reply to this message.

By clicking on the registration link, the user registration form is displayed. After submitting the form, user is redirected to the returnurl address.