cidaas is a fast and secure Cloud Identity & Access Management solution that standardises what’s important and simplifies what’s complex.
- Single Sign On (SSO) based on OAuth 2.0, OpenID Connect, SAML 2.0
- Multi-Factor-Authentication with more than 14 authentication methods, including TOTP and FIDO2
- Passwordless Authentication
- Social Login (e.g. Facebook, Google, LinkedIn and more) as well as Enterprise Identity Provider (e.g. SAML or AD)
- Security in Machine-to-Machine (M2M) and IoT
This cidaas Javascript SDK library is built on the top of OIDC client javascript library.
From CDN
<!-- Release version 2.0.4 -->
<!-- Minified version -->
<script src="https://cdn.cidaas.de/javascript/oidc/2.0.5/cidaas-javascript-sdk.min.js"></script>
From npm
npm install cidaas-javascript-sdk
Please check the Changelogs for more information about the latest release
After adding cidaas-sdk.js create a local file and name it like index.js.
var options = {
authority: 'your domain base url',
client_id: 'your app id',
redirect_uri: 'your redirect url',
post_logout_redirect_uri: 'your post logout redirect url',
popup_post_logout_redirect_uri: 'your post popup logout redirect url',
silent_redirect_uri: 'your silent redirect url',
response_type: 'id_token token',
scope: 'openid email roles profile',
mode: 'redirect'
}
#### <i class="fab fa-quote-left fa-fw" aria-hidden="true"></i> To use the PKCE Flow add 'code' as the 'response_type'
Since version 1.2.0 using 'code' as the 'response_type' will start the OAuth Authorization Flow with PKCE instead of the normal Authorization Code Flow.
var cidaas = new CidaasSDK.WebAuth(options);
The below methods will applicable for using cidaas hosted pages only.
To login through cidaas sdk, call loginWithBrowser(). This will redirect you to the hosted login page.
cidaas.loginWithBrowser();
once login successful, it will automatically redirects you to the redirect url whatever you mentioned in the options.
To complete the login process, call logincallback(). This will parses the access_token, id_token and whatever in hash in the redirect url.
cidaas.loginCallback().then(function(response) {
// your success code here
}).catch(function(ex) {
// your failure code here
});
To register through cidaas sdk, call registerWithBrowser(). This will redirect you to the hosted registration page.
cidaas.registerWithBrowser();
To get the user profile information, call getUserInfo(). This will return the basic user profile details along with groups, roles and whatever scopes you mentioned in the options.
cidaas.getUserInfo().then(function (response) {
// your success code here
}).catch(function(ex) {
// your failure code here
});;
cidaas.logout().then(function () {
// your success code here
}).catch(function(ex) {
// your failure code here
});
If you use the logout method, you need set the redirect url, if not it will automatically redirect to the login page
The below methods will be applicable for only native support
Each and every proccesses starts with requestId, it is an entry point to login or register. For getting the requestId, call getRequestId().
cidaas.getRequestId().then(function (response) {
// your success code here
}).catch(function(ex) {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"groupname":"default",
"lang":"en,en-US;q=0.9,de-DE;q=0.8,de;q=0.7",
"view_type":"login",
"requestId":"5cbcedfb-0d57-4097-993c-32db5cf94654"
}
}
To get the tenant basic information, call getTenantInfo(). This will return the basic tenant details such as tenant name and allowed login with types (Email, Mobile, Username).
cidaas.getTenantInfo().then(function (response) {
// your success code here
}).catch(function(ex) {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"tenant_name":"Cidaas Developers",
"allowLoginWith": [
"EMAIL",
"MOBILE",
"USER_NAME"
]
}
}
To get the client basic information, call getClientInfo(). This will return the basic client details such as client name and allowed social login providers (Facebook, Google and others).
cidaas.getClientInfo({
requestId: 'your requestId'
}).then(function (resp) {
// your success code here
}).catch(function(ex) {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"passwordless_enabled":true,
"logo_uri":"https://www.cidaas.com/wp-content/uploads/2018/02/logo-black.png",
"login_providers": [
"facebook",
"google",
"linkedin"
],
"policy_uri":"",
"tos_uri":"",
"client_name":"Single Page WebApp"
}
}
To login with your credentials, call loginWithCredentials(). After successful login, this will redirect you to the redirect_url that you mentioned earlier while initialising the sdk
cidaas.loginWithCredentials({
username: 'xxxx@gmail.com',
username_type: 'email',
password: '123456',
requestId: 'your requestId',
});
To login with social providers, call loginWithSocial(). This will redirect you to the facebook login page.
cidaas.loginWithSocial({
provider: 'facebook',
requestId: 'your requestId',
});
To handle registration, first you need the registration fields. To get the registration fields, call getRegistrationSetup(). This will return the fields that has to be needed while registration.
cidaas.getRegistrationSetup({
requestId: 'your requestId',
acceptlanguage: 'your locale' // de-de, en-US
}).then(function (resp) {
// your success code here
}).catch(function(ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": [
{
"dataType": "EMAIL",
"fieldGroup": "DEFAULT",
"isGroupTitle": false,
"fieldKey": "email",
"fieldType": "SYSTEM",
"order": 1,
"readOnly": false,
"required": true,
"fieldDefinition": {},
"localeText": {
"locale": "en-us",
"language": "en",
"name": "Email",
"verificationRequired": "Given Email is not verified.",
"required": "Email is Required"
}
},
{
"dataType": "TEXT",
"fieldGroup": "DEFAULT",
"isGroupTitle": false,
"fieldKey": "given_name",
"fieldType": "SYSTEM",
"order": 2,
"readOnly": false,
"required": true,
"fieldDefinition": {
"maxLength": 150
},
"localeText": {
"maxLength": "Givenname cannot be more than 150 chars",
"required": "Given Name is Required",
"name": "Given Name",
"language": "en",
"locale": "en-us"
}
},
{
"dataType": "TEXT",
"fieldGroup": "DEFAULT",
"isGroupTitle": false,
"fieldKey": "family_name",
"fieldType": "SYSTEM",
"order": 3,
"readOnly": false,
"required": true,
"fieldDefinition": {
"maxLength": 150
}
},
{
"dataType": "MOBILE",
"fieldGroup": "DEFAULT",
"isGroupTitle": false,
"fieldKey": "mobile_number",
"fieldType": "SYSTEM",
"order": 6,
"readOnly": false,
"required": false,
"fieldDefinition": {
"verificationRequired": true
}
}
]
}
Once registration fields are getting, then design your customized UI and to register user call register(). This method will create a new user.
Note: Only requestId in the headers is required.
let headers = {
requestId: your_received_requestId,
captcha: captcha,
acceptlanguage: acceptlanguage,
bot_captcha_response: bot_captcha_response
};
cidaas.register({
email: 'xxx123@xxx.com',
given_name: 'xxxxx',
family_name: 'yyyyy',
password: '123456',
password_echo: '123456',
provider: 'your provider' // FACEBOOK, GOOGLE, SELF
}, headers).then(function (response) {
// type your code here
}).catch(function(ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"sub": "7dfb2122-fa5e-4f7a-8494-dadac9b43f9d",
"userStatus": "VERIFIED",
"email_verified": false,
"suggested_action": "LOGIN"
}
}
To register with social providers, call registerWithSocial(). This will redirect you to the facebook login page.
Note: giving the queryParams is not required.
queryParams = {
dc: dc,
device_fp: device_fp
};
cidaas.registerWithSocial({
provider: 'facebook',
requestId: 'your requestId',
}, queryParams);
Once social register, it will redirect to the extra information page with requestId and trackId as query parameters. To get the missing fields, call getMissingFields(). This will return you the user information along with the missing fields. You need to render the fields using registration setup and finaly call the register().
cidaas.getMissingFields({
trackId: 'your trackId', // which you will get it from url
requestId: 'your requestId' // which you will get it from url
}).then(function (response) {
// type your code here
}).catch(function (ex) {
// your failure code here
});
Once registration successful, verify the account based on the flow. To get the details, call getCommunicationStatus().
cidaas.getCommunicationStatus({
sub: 'your sub' // which you will get on the registration response
}).then(function (response) {
// type your code here
}).catch(function(ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"EMAIL": false,
"MOBILE": false,
"USER_NAME": true
}
}
To initiate the account verification, call initiateAccountVerification(). This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
cidaas.initiateAccountVerification({
verificationMedium: 'email',
requestId: 'your requestId',
processingType: 'CODE',
sub: 'your sub'
}).then(function (response) {
// type your code here
}).catch(function(ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"accvid": "32aca19a-c83a-4ea5-979e-f8242605bcd4"
}
}
To complete the verification, call verifyAccount().
cidaas.verifyAccount({
accvid: 'your accvid', // which you will get on initiate account verification response
code: 'your code in email or sms or ivr'
}).then(function (response) {
// type your code here
}).catch(function(ex) {
// your failure code here
});
To initiate the password resetting, call initiateResetPassword(). This will send verification code to your email or mobile based on the resetMedium you mentioned.
cidaas.initiateResetPassword({
email: 'xxxxxx@xxx.com',
processingType: 'CODE',
requestId: 'your requestId',
resetMedium: 'email'
}).then(function (response) {
// type your code here
}).catch(function(ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"reset_initiated": true,
"rprq": "e98b2451-f1ca-4c81-b5e0-0ef85bb49a05"
}
}
To handling the reset password by entering the verification code you received, call handleResetPassword(). This will check your verification code was valid or not and allows you to proceed to the next step
cidaas.handleResetPassword({
code: 'your code in email or sms or ivr',
resetRequestId: 'your resetRequestId' // which you will get on initiate reset password response
}).then(function (response) {
// type your code here
}).catch(function(ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"exchangeId": "d5ee97cd-2454-461d-8e42-554371a15c00",
"resetRequestId": "1834130e-7f53-4861-99d3-7f934fbba179"
}
}
To change the password, call resetPassword(). This will allow you to change your password.
cidaas.resetPassword({
password: '123456',
confirmPassword: '123456',
exchangeId: 'your exchangeId', // which you will get on handle reset password response
resetRequestId: 'your resetRequestId' // which you will get on handle reset password response
}).then(function (response) {
// type your code here
}).catch(function(ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"reseted": true
}
}
To change the password, call changePassword(). This will allow you to change your password.
cidaas.changePassword({
old_password: '123456',
new_password: '123456789',
confirm_password: '123456789',
identityId: 'asdauet1-quwyteuqqwejh-asdjhasd',
}, 'your access token')
.then(function () {
// type your code here
}).catch(function (ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"changed": true
}
}
To get user profile details, pass access token to getProfileInfo().
cidaas.getProfileInfo({
access_token: 'your access token'
}).then(function (response) {
// type your code here
}).catch(function (ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"userAccount": {
"userIds": [
{
"key": "self.email",
"value": "testuser@gmail.com"
}
],
"className": "de.cidaas.management.db.UserAccounts",
"_id": "ac45bdda-93bf-44f1-b2ff-8465495c3417",
"sub": "33361c59-368b-48e3-8739-38d7ee8f7573",
"user_status_reason": "",
"userStatus": "VERIFIED",
"customFields": {
"Test_consent_HP": true,
"customer_number": "CN456",
"invoice_number": "IN456"
},
"createdTime": "2021-05-27T07:38:29.579Z",
"updatedTime": "2021-06-24T11:02:43.188Z",
"__ref": "1624532562750-69ab9fff-2a71-4a05-8d67-6886376b51d6",
"__v": 0,
"lastLoggedInTime": "2021-06-24T11:02:43.186Z",
"lastUsedIdentity": "bbee960d-6a80-424e-99bd-586d74f1053e",
"mfa_enabled": true,
"id": "ac45bdda-93bf-44f1-b2ff-8465495c3417"
},
"identity": {
"_id": "bbee960d-6a80-424e-99bd-586d74f1053e",
"className": "de.cidaas.core.db.EnternalSocialIdentity",
"sub": "33361c59-368b-48e3-8739-38d7ee8f7573",
"provider": "self",
"email": "testuser@gmail.com",
"email_verified": true,
"family_name": "Test",
"given_name": "User",
"locale": "en-us",
"createdTime": "2021-05-27T07:38:29.908Z",
"updatedTime": "2021-06-24T11:02:43.188Z",
"__ref": "1624532562750-69ab9fff-2a71-4a05-8d67-6886376b51d6",
"__v": 0,
"birthdate": "1993-06-07T18:30:00.000Z",
"id": "bbee960d-6a80-424e-99bd-586d74f1053e"
},
"customFields": {},
"roles": [
"USER"
],
"groups": []
}
}
To get the user profile information, call getUserProfile().
cidaas.getUserProfile({
access_token: 'your access token'
}).then(function (response) {
// type your code here
}).catch(function (ex) {
// your failure code here
});
{
"sub": "cc28a557-ce0d-4896-9580-49639cbde8d5",
"email": "davidjhonson1984@gmail.com",
"email_verified": true,
"name": "David Jhonson",
"family_name": "Jhonson",
"given_name": "David",
"nickname": "test",
"preferred_username": "davidjhonson",
"gender": "Male",
"locale": "en-us",
"updated_at": 1527662349,
"username": "davidjhonson"
}
To update the user profile information, call updateProfile().
cidaas.updateProfile({
family_name: 'Doe',
given_name: 'John',
provider: 'self'
}, 'your access token', 'your sub').then(function () {
// type your code here
}).catch(function (ex) {
// your failure code here
});
{
"updated": true
}
To logout the user, call logoutUser().
cidaas.logoutUser({
access_token : 'your accessToken'
});
To delete the user account directly in the application, call deleteUserAccount(). This method will delete the user account with requestId as the query parameter.
This method takes an object as input.
options = {
sub: "7e4f79a9-cfbc-456d-936a-e6bc1de2d4b9",
requestId: "7d86460b-8288-4341-aed1- 10dd27a4565c",
accept-language: "en"
}
The usage of the method is as follows.
cidaas.deleteUserAccount(options).then(function (response) {
// your success code here
}).catch(function(ex) {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"result": true
}
}
After successful login, we can add multifactor authentications.
To configure email, call setupEmail().
this.cidaas.setupEmail({
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To enroll email, call enrollEmail().
this.cidaas.enrollEmail({
statusId: 'your status id', // which you received in setup email response
code: '1221234234', // which you received in email
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"sub":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
"trackingCode": "75hafysd7-5f5cbb84-4ceb-4975-b347-4bfac61e92"
}
}
To send a verification code to email, call initiateEmail().
this.cidaas.initiateEmail({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To verify the code, call authenticateEmail().
this.cidaas.authenticateEmail({
verifierPassword: 'your generated otp', // received in Email
code: 'your generated otp', // received in Email
statusId: 'your status id', // received from initiate call
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To configure SMS, call setupSMS().
this.cidaas.setupSMS({
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To enroll SMS, call enrollSMS().
this.cidaas.enrollSMS({
statusId: 'your status id', // which you received in setup sms response
code: '1221234234', // which you received via sms
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"sub":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
"trackingCode": "75hafysd7-5f5cbb84-4ceb-4975-b347-4bfac61e92"
}
}
To send a verification code to sms, call initiateSMS().
this.cidaas.initiateSMS({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To verify the code, call authenticateSMS().
this.cidaas.authenticateSMS({
verifierPassword: 'your generated otp', // received in SMS
code: 'your generated otp', // received in SMS
statusId: 'your status id', // received from initiate call
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To configure IVR, call setupIVR().
this.cidaas.setupIVR({
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To enroll IVR, call enrollIVR().
this.cidaas.enrollIVR({
statusId: 'your status id', // which you received in setup ivr response
code: '1221234234', // which you received via voice call
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"sub":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
"trackingCode": "75hafysd7-5f5cbb84-4ceb-4975-b347-4bfac61e92"
}
}
To send a verification code to a voice call, call initiateIVR().
this.cidaas.initiateIVR({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To verify the code, call authenticateIVR().
this.cidaas.authenticateIVR({
verifierPassword: 'your generated otp', // received via voice call
code: 'your generated otp', // received via voice call
statusId: 'your status id', // received from initiate call
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To configure backupcode, call setupBackupcode().
this.cidaas.setupBackupcode({
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
"backupcodes": [
{
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248",
"code": "8767344",
"used": false
}
]
}
}
To create a verification code, call initiateBackupcode().
this.cidaas.initiateBackupcode({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To verify the code, call authenticateBackupcode().
this.cidaas.authenticateBackupcode({
verifierPassword: 'your generated otp', // received via voice call
code: 'your generated otp', // received via voice call
statusId: 'your status id', // received from initiate call
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To configure TOTP, call setupTOTP().
this.cidaas.setupTOTP({
logoUrl: 'your logo url',
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To enroll TOTP, call enrollTOTP().
this.cidaas.enrollTOTP({
statusId: 'your status id', // which you received in setup totp response
code: '1221234234', // which you seen in any of the authenticator apps you configured
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"sub":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
"trackingCode": "75hafysd7-5f5cbb84-4ceb-4975-b347-4bfac61e92"
}
}
To initiate a TOTP verification type, call initiateTOTP().
this.cidaas.initiateTOTP({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To verify the code, call authenticateTOTP().
this.cidaas.authenticateTOTP({
verifierPassword: 'your generated otp', // received via voice call
code: 'your generated otp', // received via voice call
statusId: 'your status id', // received from initiate call
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To configure Pattern, call setupPattern().
this.cidaas.setupPattern({
logoUrl: 'your logo url',
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Once response is received, listen to the socket
To initiate a PATTERN verification type, call initiatePattern().
this.cidaas.initiatePattern({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Once response is received, listen to the socket
To configure TouchId, call setupTouchId().
this.cidaas.setupTouchId({
logoUrl: 'your logo url',
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Once response is received, listen to the socket
To initiate a TOUCHID verification type, call initiateTouchId().
this.cidaas.initiateTouchId({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Once response is received, listen to the socket
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To configure SmartPush, call setupSmartPush().
this.cidaas.setupSmartPush({
logoUrl: 'your logo url',
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Once response is received, listen to the socket
To initiate a SMART PUSH verification type, call initiateSmartPush().
this.cidaas.initiateSmartPush({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Once response is received, listen to the socket
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To configure Face, call setupFace().
this.cidaas.setupFace({
logoUrl: 'your logo url',
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Once response is received, listen to the socket
To initiate a FACE verification type, call initiateFace().
this.cidaas.initiateFace({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Once response is received, listen to the socket
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
To configure Voice, call setupVoice().
this.cidaas.setupVoice({
logoUrl: 'your logo url',
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Once response is received, listen to the socket
To initiate a VOICE verification type, call initiateVoice().
this.cidaas.initiateVoice({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Once response is received, listen to the socket
To continue after MFA completion, call mfaContinue().
this.cidaas.mfaContinue({
trackingCode: 'your tracking Code', // receives in socket
track_id: 'your track id',
sub: 'your sub',
requestId: 'your request id'
});
For the first time login, the user needs to accept the terms and conditions.
To get the details of consent tile and description, call getConsentDetails()
this.cidaas.getConsentDetails({
consent_name: 'your consent name'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"title" : 'consent title',
"description" : 'consent description',
"userAgreeText" : 'I agree'
}
}
To accept consent, call acceptConsent()
this.cidaas.acceptConsent({
name: 'your consent name',
sub: 'your sub',
client_id: 'your client id',
accepted: true
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"accepted": true
}
}
To continue after Consent acceptance, call consentContinue().
this.cidaas.consentContinue({
name: 'your consent name',
version: 'your consent version',
client_id: 'your client id',
track_id: 'your track id',
sub: 'your sub',
});
To get the list of existing users in deduplication, call getDeduplicationDetails().
this.cidaas.getDeduplicationDetails({
track_id: 'your track id'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": [
{
"provider": 'SELF',
"sub": 'etsdf34545sdfsdf',
"email": 'davidjhonson@gmail.com',
"emailName": 'davidjhonson@gmail.com',
"firstname": 'David',
"lastname": 'Jhonson',
"displayName": 'David Jhonson',
}
]
}
To register new user in deduplication, call registerDeduplication().
this.cidaas.registerDeduplication({
track_id: 'your track id'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success": true,
"status": 200,
"data": {
"sub": "7dfb2122-fa5e-4f7a-8494-dadac9b43f9d",
"userStatus": "VERIFIED",
"email_verified": false,
"suggested_action": "LOGIN"
}
}
To use the existing users in deduplication, you need to enter password for the users and call deduplicationLogin().
this.cidaas.deduplicationLogin({
sub: 'your sub',
requestId: 'your request id',
password: 'your password'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
{
"success":true,
"status":200,
"data": {
"token_type":"Bearer",
"expires_in":86400,
"access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6IjEwMjM2ZWZiLWRlMjEtNDI5Mi04Z.",
"session_state":"3F7CuT3jnKOTwRyyLBWaRizLiPm5mJ4PnhY.jfQO3MeEAuM",
"viewtype":"login",
"grant_type":"login"
}
}
Install ng-socket-io in your project and refer the following link https://www.npmjs.com/package/ng-socket-io to configure. Use the "your_base_url/socket-srv/socket/socket.io" path for the socket listening url and enter the following snippet
this.socket.emit("join", {
id: 'your status id' // which you received in the response of setup call
});
this.cidaas.setupPattern({
logoUrl: 'your logo url',
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
this.socket.emit("join", {
id: response.data.statusId
});
}).catch((err) => {
// your failure code here
});
You can listen the socket anywhere in your component
this.socket.on("status-update", (msg) => {
if (msg.status == "SCANNED") {
// do next process
}
else if (msg.status == "ENROLLED") {
// do next process
}
});
this.socket.emit("on-trigger-verification", {
id: 'your status id' // which you received in the response of initiate call
});
this.cidaas.initiatePattern({
sub: 'your sub',
physicalVerificationId: 'your physical verification id',
userDeviceId: deviceId,
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
deviceInfo: {
deviceId: 'your device id'
}
}).then((response) => {
this.socket.emit("on-trigger-verification", {
id: response.data.statusId
});
}).catch((err) => {
// your failure code here
});
You can listen the socket anywhere in your component.
this.socket.on("status-update", (msg) => {
if (msg.status == "AUTHENTICATED") {
// do next process
}
});
F