registerUser
Before a user can authenticate using PIN or fingerprint, a user will need to register with your Token Server. Registration can be initiated using this method.
It may be required to handle registration with some additional action (PIN/Fingerprint) handling. The SDK notifies the app about the state of the registration by the use of events. The application should listen for these using the SKD's addEventListener.
registerUser(identityProviderId: string | null, scopes: string[]): Promise<Types.AuthData>
| Property | Type | Description |
|---|---|---|
| identityProviderId | string | null | Identity provider ID or null for default |
| scopes (optional) | string[] | An array of scopes the user will register for |
Success
| Property | Description |
|---|---|
| Types.AuthData | The profileId and an optional customInfo object with additional data \n\nreturned as a result of the custom authentication or the custom \n\nregistration process. |
Example
OneWelcomeSdk.registerUser(providerId)
.then(authData => {
console.log('Registration success! ')
})
.catch(error => {
console.error('Registration failed: ', error.message)
})
const handleNotification = useCallback(
async (event: any) => {
switch (event.action) {
case Events.PinNotification.Open:
await handleOpen(event.flow, event.profileId, event.data);
break;
case Events.PinNotification.Error:
handleError(event.errorMsg, event.userInfo ?? undefined);
break;
case Events.PinNotification.Close:
setInitialState();
break;
}
},
[handleOpen, setConfirmState, handleError, setInitialState],
);
__ The Flow of registration gets passed by events.
const listener = OnewelcomeSdk.addEventListener(
Events.SdkNotification.Pin,
handleNotification,
);