Mobile identity registration
Before a user can use mobile identity to log in to your website, they will need to enrol an authentication device. In this scenario you will see how to add this enrolment to your already existing user registration process.
How does it work?
For this scenario, let's assume that you already have a way for a user to sign up on your website. Typically, this involves the user providing a username or email address. For the sake of this explanation, let's assume the registration flow is as follows:
- The user enters a username.
- You create a new account for the user.
- The user indicates their notification preferences.
- The user fills out their profile.
- You take the user to the welcome page.
Your registration process may consist of only the first two steps, or it may have steps not mentioned here, or it may have these steps in a different order. It doesn't matter. As long as you create an account for the user, this will work.
You can insert the mobile identity enrollment anywhere into the process after the account has been created. Here's what that looks like.
- You generate a QR code.
- You show the QR code to the user.
- The user scans the QR code with the device they want to use as their authentication device.
- You wait until the user has scanned the QR code.
What parts of the API do you require?
To add Mobile Identity to your registration process, you require the following API endpoints:
POST /auth/oauth2.0/v1/access_token
to obtain an access token.POST /omi/qr/enrol
to generate a QR code.GET /omi/qr/enrol/status
to check if the user has scanned the QR code.
Example implementation
You will need to decide where in your registration process you will ask the user to enroll their authentication device. The rule to keep in mind: you must create an account for the user before you can show them a QR code, because you need the UUID as a reference in later steps.
This means you first need to ask the user for a username and create their account. After that, you can put the enrollment process wherever you like.
Of course, if you don't have any extra steps in your registration process, then the only possibility is to create an account and then enroll a device.
Obtain an access token
To call the IDAAS-core endpoints, you need to obtain an access token. The application requires an access token to authenticate to the OneWelcome Identity Platform. We recommend using the OAuth2 client credentials flow to generate your access token.
You must specify the following scopes for the access token:
credential:omi:enrol:qr:admin:post
credential:omi:enrol:status:get
Generate a QR code
You must generate a QR code before you can show a QR code to the user. Generate a QR code using the /omi/qr/enrol
endpoint. The response returns the QR code as a base64-encoded PNG image. The QR code can be displayed on the webpage using the <img>
element.
Include the entire base64-encoded PNG image value in the scr-attribute
and prefix the value with data:image/png;base64,
.
html
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAIAAACzY+a1AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DA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BHwkpDtR7//gpeRjb0QrwHZ2CHRIS6nDjXLxsyNke0Z4jVDFDtbWfxNd2F5DnyF/LEQ5iPi5RRJ8L9T2Z41gaxniGKnkcWAmO7VypI55C6RhNlrysaAbPiI7o+yu7A8fYXlkZ7VH+2/f//++fNnDhpevXp1fHxMD/ijPXd0QKDELY14BMd5bmgeVKKwxosT+a0gJcOykof+HSkvA0Q3U8rGsCVrH9HNEAW4ySJXiRLHCVkPyAZsSXSWksHLpWAP0vJIGz558mTTL5t+/fpFD/wVEPftvEJTkKVJkKt4JpirynxJ+L4YUTLVLsm8zlyRJHgBj+DFliaZP5TMOzOqzJeE74sRJVPtkvXr/PPP/wGmzRo8zvXsBQAAAABJRU5ErkJggg==">
css
#qr {
display: block;
width: 300px;
height: 300px;
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAIAAACzY+a1AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAqLSURBVHhe7ZuxblVLD4Uvf49CKKh4AQqk1BQkDRXvmFegoUVKJNKi0CFBFVFRIPIE+Q32cQavscf75FzpWvJX7fEsr/Fmti2FwKN/HsDd3Z08AY8e/XYOBAinIGiiSt1aRjzzkcCNCU5Rgi3GeI5kikQk5+jo6OTkhJ+XXF9f397e0sOymkCA5N9Zlfjn5UU885HAjQlOUYItxniOcMrWu5Cn09NTsk5CYs6S9VCTrHcRWYSwMoMkbESStyCZ8Ba8TCI5OyQ6IBsDHN96F//jtKYu0ux0mRcXF/Tw9evXjx8/ctDw9u3bZ8+e0cPZ2dnl5SU90FfwZ8edMLoM8AYOknFD8v6K9xabrEy1mIuvwxq9i5ubmw8fPvzZsbx58+b58+f0QHfBkfvmPT8/lxBwdXXFGhJzhJcjHCemyxHZGLZkPRN7SMKAbMy2GNkOcz1EN0MUibeQ7ZmA43oX79694wjy/v171pC4B2l5DnOFNAEY/jQIjsvi7k62h2EiG7MtWe+Q6AyxGJC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jwVxMUZaaTSXhlgFP8QrInKugLTM17y4sT19hefb5uVDxhsYmliY4cLyaR4wmk6IsK0E3L4XwTtyjpKmyu7A8fYXlcf/tTDAisJ29meCZxzzEZDpqpmRsvUo07r34iHdQvlRlelx3YXn6CsvjDtJNLAcLxj3lyLK2wM3LzaR4JaGnpwzIl0oY/6myu7A8fYXl2TwHRvaYPEowgowtnrJHBAUBB8lVllno70XQiuLdheWRWz06Ojo5OeHnJdfX17e3t/SAH4tBBUjwbRpbPGWPCAoCDpKrLLPQ34ug1f1xp6entEhCYs6StQ/LRmQjRKQ7JDogGwOyMWzJGpDtEJHuxLIY4Dgh6xCR+ohuhih2SPTveA/S8khjUmNdXFzQw83NzadPnzhoeP369dOnT+nh7Ozs8vKSHszngESN72OyMCWwNZMHwVzEuAUFeKeMLE8MTEyuKewvdJCen59LCLi6umINDlJejsjGDomGiHRANnZIdEA2wko8JCHEU3KckPUsskQSckjOjB6k5ekrLM+Br1B6++6OhvVkXs+QhF3KiBHwkpDtR7//gpeRjb0QrwHZ2CHRIS6nDjXLxsyNke0Z4jVDFDtbWfxNd2F5DnyF/LEQ5iPi5RRJ8L9T2Z41gaxniGKnkcWAmO7VypI55C6RhNlrysaAbPiI7o+yu7A8fYXlkZ7VH+2/f//++fNnDhpevXp1fHxMD/ijPXd0QKDELY14BMd5bmgeVKKwxosT+a0gJcOykof+HSkvA0Q3U8rGsCVrH9HNEAW4ySJXiRLHCVkPyAZsSXSWksHLpWAP0vJIGz558mTTL5t+/fpFD/wVEPftvEJTkKVJkKt4JpirynxJ+L4YUTLVLsm8zlyRJHgBj+DFliaZP5TMOzOqzJeE74sRJVPtkvXr/PPP/wGmzRo8zvXsBQAAAABJRU5ErkJggg==')
}
Check the status
Now it's up to the user to scan the QR code you're showing them. You can find out if they've done so by polling the endpoint /omi/qr/enrol/status
. We recommend you poll every second or two, so you can act on the user's response quickly without overloading the servers.