JavaScript (Version -2) Getting Started
This cidaas Javascript SDK library is built on the top of OIDC client javascript library. The Example which explains integration of javascript SDK with client application needs to be improved and we are working on that.
Installation
From CDN
<!-- Latest patch release -->
<script src="https://cdn.cidaas.de/javascript/oidc/v2/cidaas-sdk.js"></script>
or
<!-- Latest patch release -->
<script src="https://cdn.cidaas.de/javascript/oidc/v2/cidaas-sdk.min.js"></script>
Initialisation
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'
}
Initialise the cidaas sdk using the options.
var cidaas = new CidaasSDK(options);
Usage
Browser Methods
The below methods will applicable for using cidaas hosted pages only.
Login With Browser
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
});
Register With Browser
To register through cidaas sdk, call registerWithBrowser(). This will redirect you to the hosted registration page.
cidaas.registerWithBrowser();
Getting UserInfo
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
});;
Logout
cidaas.logout().then(function () {
// your success code here
}).catch(function(ex) {
// your failure code here
});
In logout method you need give redirect url, if not it will automatically redirect to login page
API call
The below methods will be applicable for only native support
Login and Registration
Getting RequestId
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
});
Response Object:
{
"success":true,
"status":200,
"data":{
"groupname":"default",
"lang":"en-US,en;q=0.9,de-DE;q=0.8,de;q=0.7",
"view_type":"login",
"requestId":"45a921cf-ee26-46b0-9bf4-58636dced99f”
}
}
Getting Tenant Info
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
});
Response Object:
{
"success": true,
"status": 200,
"data": {
"tenant_name": "Cidaas Management",
"allowLoginWith": [
"EMAIL",
"MOBILE",
"USER_NAME"
]
}
}
Get Client Info
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
});
Response Object:
{
"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",
"linkedin"
],
"policy_uri":"",
"tos_uri":"",
"client_name":"demo-app1”
}
}
Login with credentials
To login with your credentials, call loginWithCredentials().
cidaas.loginWithCredentials({
username: 'xxxx@gmail.com',
username_type: 'email',
password: '123456',
requestId: 'your requestId',
}).then(function (response) {
// your success code here
}).catch(function (ex) {
// your failure code here
});
Request Object:
{
"username": "davidjhonson@gmail.com",
"username_type": "email",
"password": "123456",
"requestId": "744b499a-7291-4560-bce9-bda529ceb0d7"
}
Response Object:
{
"success": true,
"status": 200,
"data": {
"token_type": "Bearer",
"expires_in": 86400,
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjUxNWYxMGE5LTVmNDktNGZlYS04MGNlLTZmYTkzMzk2YjI4NyJ9*****",
"session_state": "CNT7GGALeoKyTF6Og-cZHAuHUJBQ20M0jLL35oh3UGk.vcNxCNq4Y68",
"viewtype": "login",
"grant_type": "login"
}
}
Login with social
To login with social providers, call loginWithSocial(). This will redirect you to the facebook login page.
cidaas.loginWithSocial({
provider: 'facebook',
requestId: 'your requestId',
});
{
provider:‘facebook’,
requestId:’8c7c9e38-2de6-425d-960d-73051872f182’
}
Getting Registration Fields
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
});
Response Object:
{
"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
}
}
]
}
Register user
Once registration fields are getting, then design your customized UI and to register user call register(). This method will create a new user.
cidaas.register({
email: 'xxx123@xxx.com',
given_name: 'xxxxx',
family_name: 'yyyyy',
password: '123456',
password_echo: '123456',
provider: 'your provider' // FACEBOOK, GOOGLE, SELF
}, requestId).then(function (response) {
// type your code here
}).catch(function(ex) {
// your failure code here
});
Request Object:
{
"provider": "SELF",
"email": "davidjhonson@gmail.com",
"given_name": "David",
"family_name": "Jhonson",
"password": "test123",
"password_echo": "test123",
"username": "davidjhonson",
"customfield1": "testcustomfields"
}
Response Object:
{
"success": true,
"status": 200,
"data": {
"sub": "7dfb2122-fa5e-4f7a-8494-dadac9b43f9d",
"userStatus": "VERIFIED",
"email_verified": false,
"suggested_action": "LOGIN"
}
}
Register with social
To register with social providers, call registerWithSocial(). This will redirect you to the facebook login page.
cidaas.registerWithSocial({
provider: 'facebook',
requestId: 'your requestId',
});
Get Missing Fields
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
});
Account Verification
Get Communication Status
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
});
Response Object:
{
"success": true,
"status": 200,
"data": {
"EMAIL": false,
"MOBILE": false,
"USER_NAME": true
}
}
Intiate Account Verification
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
});
Request Object:
{
"verificationMedium": "email",
"requestId": "3ad58339-0dd5-4d2a-ad44-8f74d7f58251",
"processingType": "CODE",
"sub": "7dfb2122-fa5e-4f7a-8494-dadac9b43f9d"
}
Response Object:
{
"success": true,
"status": 200,
"data": {
"accvid": "32aca19a-c83a-4ea5-979e-f8242605bcd4"
}
}
Authenticate Account Verification
To complete the verification, call authenticateAccountVerification().
cidaas.authenticateAccountVerification({
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
});
Request Object:
{
"code":"123456",
"accvid":"32aca19a-c83a-4ea5-979e-f8242605bcd4"
}
Resetting your password
Initiate Reset Password
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
});
Request Object:
{
"email": "davidjhonson@gmail.com",
"processingType": "CODE",
"requestId": "11e166fc-a41b-4154-9c8c-6329edf612bd",
"resetMedium": "email"
}
Response Object:
{
"success": true,
"status": 200,
"data": {
"reset_initiated": true,
"rprq": "e98b2451-f1ca-4c81-b5e0-0ef85bb49a05"
}
}
Handle Reset Password
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
});
Request Object:
{
"code": "123456",
"resetRequestId": "e98b2451-f1ca-4c81-b5e0-0ef85bb49a05"
}
Response Object:
{
"success": true,
"status": 200,
"data": {
"exchangeId": "d5ee97cd-2454-461d-8e42-554371a15c00",
"resetRequestId": "1834130e-7f53-4861-99d3-7f934fbba179"
}
}
Change Password
To change the password, call changePassword(). This will allow you to change your password.
cidaas.changePassword({
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
});
Request Object:
{
"password": "test1234",
"confirmPassword": "test1234",
"exchangeId": "d5ee97cd-2454-461d-8e42-554371a15c00",
"resetRequestId": "1834130e-7f53-4861-99d3-7f934fbba179"
}
Response Object:
{
"success": true,
"status": 200,
"data": {
"reseted": true
}
}
Getting user profile
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
});
Response Object:
{
"sub": "cc28a557-ce0d-4896-9580-49639cbde8d5",
"email": "davidjhonson@gmail.com",
"email_verified": true,
"name": "test david",
"family_name": "jhonson",
"given_name": "test",
"nickname": "test",
"preferred_username": "davidjhonson@gmail.com",
"gender": "Male",
"locale": "en-us",
"updated_at": 1527662349,
"username": "davidjhonson@gmail.com"
}
Logout user
To logout the user, call logoutUser().
cidaas.logoutUser({
accessToken : 'your accessToken'
}).then(function (response) {
// type your code here
}).catch(function (ex) {
// your failure code here
});
Request Query String:
access_token_hint=eyJhbGciOiJSUzI1NiIsImtpZCI6IjEwMjM2ZWZiLWRlMjEtNDI5Mi04ZDRlLTRmZGIxNjhhZDg4ZSJ9****
Physical Verification
After successful login, we can add multifactor authentications.
Initiate Email
To send a verification code to email, call initiateEmail().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Authenticate Email
To verify the code, call authenticateEmail().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"sub": "6f7e672c-1e69-4108-92c4-3556f13eda74",
"trackingCode": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
SMS
Initiate SMS
To send a verification code to sms, call initiateSMS().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Authenticate SMS
To verify the code, call authenticateSMS().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"sub": "6f7e672c-1e69-4108-92c4-3556f13eda74",
"trackingCode": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
IVR
Initiate IVR
To send a verification code to a voice call, call initiateIVR().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Authenticate IVR
To verify the code, call authenticateIVR().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"sub": "6f7e672c-1e69-4108-92c4-3556f13eda74",
"trackingCode": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
BACKUPCODE
Initiate Backupcode
To create a verification code, call initiateBackupcode().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Authenticate Backupcode
To verify the code, call authenticateBackupcode().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"sub": "6f7e672c-1e69-4108-92c4-3556f13eda74",
"trackingCode": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
TOTP
Initiate TOTP
To initiate a TOTP verification type, call initiateTOTP().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
Authenticate TOTP
To verify the code, call authenticateTOTP().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"sub": "6f7e672c-1e69-4108-92c4-3556f13eda74",
"trackingCode": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
PATTERN
Initiate PATTERN
To initiate a PATTERN verification type, call initiatePattern().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
TOUCHID
Initiate TOUCHID
To initiate a TOUCHID verification type, call initiateTouchId().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
SMART PUSH
Initiate SMART PUSH
To initiate a SMART PUSH verification type, call initiateSmartPush().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
FACE
Initiate FACE
To initiate a FACE verification type, call initiateFace().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
VOICE
Initiate VOICE
To initiate a VOICE verification type, call initiateVoice().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
FACE
Initiate FACE
To initiate a FACE verification type, call initiateFace().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
}
}
MFA Continue
To continue after MFA completion, call mfaContinue().
Sample code
this.cidaas.mfaContinue({
trackingCode: 'your tracking Code', // receives in socket
track_id: 'your track id',
sub: 'your sub',
requestId: 'your request id',
verificationType: 'your verification type'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Response
{
"success": true,
"status": 200,
"data": {
"token_type": "Bearer",
"expires_in": 86400,
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjEwMjM2ZWZiLWRlMjEtNDI5Mi04Z.",
"session_state": "3F7CuT3jnKOTwRyyLBWaRizLiPm5mJ4PnhY.jfQO3MeEAuM",
"viewtype": "login",
"grant_type": "login"
}
}
Consent Management
For the first time login, the user needs to accept the terms and conditions.
Get consent page url
To get a consent url to display, call getConsentPageurl()
Sample code
this.cidaas.getConsentPageurl({
consent_name: 'your consent name',
consent_version: 'consent version'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Response
{
"success":true,
"status":200,
"data": 'https://cidaas.de/privacy-policy'
}
Get consent details
To get the details of consent tile and description, call getConsentDetails()
Sample code
this.cidaas.getConsentDetails({
consent_name: 'your consent name'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Response
{
"success":true,
"status":200,
"data": {
"title" : 'consent title',
"description" : 'consent description',
"userAgreeText" : 'I agree'
}
}
Accept consent
To accept consent, call acceptConsent()
Sample code
this.cidaas.acceptConsent({
name: 'your consent name',
sub: 'your sub',
version: 'your consent version',
client_id: 'your client id',
accepted: true
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Response
{
"success":true,
"status":200,
"data": {
"name": 'your consent name',
"sub": 'your sub',
"version": 'your consent version',
"client_id": 'your client id',
"accepted": true
}
}
Consent Continue
To continue after Consent acceptance, call consentContinue().
Sample code
this.cidaas.consentContinue({
name: 'your consent name',
version: 'your consent version',
client_id: 'your client id',
track_id: 'your track id',
sub: 'your sub',
requestId: 'your request id'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Response
{
"success": true,
"status": 200,
"data": {
"token_type": "Bearer",
"expires_in": 86400,
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjEwMjM2ZWZiLWRlMjEtNDI5Mi04Z.",
"session_state": "3F7CuT3jnKOTwRyyLBWaRizLiPm5mJ4PnhY.jfQO3MeEAuM",
"viewtype": "login",
"grant_type": "login"
}
}
Deduplication
Get deduplication details
To get the list of existing users in deduplication, call getDeduplicationDetails().
Sample code
this.cidaas.getDeduplicationDetails({
track_id: 'your track id'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Response
{
"success":true,
"status":200,
"data": [
{
"provider": 'SELF',
"sub": 'etsdf34545sdfsdf',
"email": 'davidjhonson@gmail.com',
"emailName": 'davidjhonson@gmail.com',
"firstname": 'David',
"lastname": 'Jhonson',
"displayName": 'David Jhonson',
}
]
}
Register deduplication
To register new user in deduplication, call registerDeduplication().
Sample code
this.cidaas.registerDeduplication({
track_id: 'your track id'
}).then((response) => {
// type your code here
}).catch((err) => {
// your failure code here
});
Response
{
"success": true,
"status": 200,
"data": {
"sub": "7dfb2122-fa5e-4f7a-8494-dadac9b43f9d",
"userStatus": "VERIFIED",
"email_verified": false,
"suggested_action": "LOGIN"
}
}
Deduplication login
To use the existing users in deduplication, you need to enter password for the users and call deduplicationLogin().
Sample code
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
});
Response
{
"success": true,
"status": 200,
"data": {
"token_type": "Bearer",
"expires_in": 86400,
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjEwMjM2ZWZiLWRlMjEtNDI5Mi04Z.",
"session_state": "3F7CuT3jnKOTwRyyLBWaRizLiPm5mJ4PnhY.jfQO3MeEAuM",
"viewtype": "login",
"grant_type": "login"
}
}