cidaas-javascript-sdk 3.1.5 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -2
- package/README.md +96 -2508
- package/dist/authentication/index.d.ts +90 -26
- package/dist/authentication/index.js +117 -56
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -3
- package/dist/web-auth/ConsentService.d.ts +87 -23
- package/dist/web-auth/ConsentService.js +95 -32
- package/dist/web-auth/Entities.d.ts +22 -39
- package/dist/web-auth/Helper.d.ts +1 -1
- package/dist/web-auth/Helper.js +20 -5
- package/dist/web-auth/JwtHelper.d.ts +7 -0
- package/dist/web-auth/JwtHelper.js +90 -0
- package/dist/web-auth/LoginService.d.ts +99 -58
- package/dist/web-auth/LoginService.js +100 -128
- package/dist/web-auth/TokenService.d.ts +120 -25
- package/dist/web-auth/TokenService.js +161 -36
- package/dist/web-auth/UserService.d.ts +260 -62
- package/dist/web-auth/UserService.js +304 -153
- package/dist/web-auth/VerificationService.d.ts +198 -99
- package/dist/web-auth/VerificationService.js +204 -177
- package/dist/web-auth/WebAuth.d.ts +219 -454
- package/dist/web-auth/WebAuth.js +370 -904
- package/package.json +2 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-

|
|
1
|
+

|
|
2
2
|
|
|
3
3
|
## About cidaas:
|
|
4
4
|
[cidaas](https://www.cidaas.com)
|
|
@@ -13,20 +13,34 @@
|
|
|
13
13
|
|
|
14
14
|
# Cidaas Javascript SDK
|
|
15
15
|
|
|
16
|
-
This cidaas Javascript SDK library is built on the top of [OIDC client
|
|
16
|
+
This cidaas Javascript SDK library is built on the top of [OIDC client typescript library](https://github.com/authts/oidc-client-ts).
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
Please check the [Changelog](https://github.com/Cidaas/cidaas-sdk-javascript-v2/blob/master/CHANGELOG.md) for more information about the latest release.
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
* Node.js - Download & Install Node.js. The version required is >= 8
|
|
22
|
-
* npm - node package manager to add the package and install dependent packages
|
|
20
|
+
## Table of Contents
|
|
23
21
|
|
|
24
|
-
|
|
22
|
+
<!--ts-->
|
|
23
|
+
* [Installation](#installation)
|
|
24
|
+
* [Initialisation](#initialisation)
|
|
25
|
+
* [Usage](#usage)
|
|
26
|
+
* [Functions Overview](#functions-overview)
|
|
27
|
+
<!--ts-->
|
|
28
|
+
* [Authentication Functions](#authentication-functions)
|
|
29
|
+
* [Login Management](#login-management)
|
|
30
|
+
* [User Management](#user-management)
|
|
31
|
+
* [Token Management](#token-management)
|
|
32
|
+
* [Verification Management](#verification-management)
|
|
33
|
+
* [Consent Management](#consent-management)
|
|
34
|
+
* [Other Functionality](#other-functionality)
|
|
35
|
+
<!--te-->
|
|
36
|
+
* [Possible Error](#possible-error)
|
|
37
|
+
|
|
38
|
+
### Installation
|
|
25
39
|
|
|
26
40
|
From CDN
|
|
27
41
|
|
|
28
42
|
```html
|
|
29
|
-
<!-- Replace the required <version> in the script tag, example:
|
|
43
|
+
<!-- Replace the required <version> in the script tag, example: 4.0.0. All the released tag can be found https://www.npmjs.com/package/cidaas-javascript-sdk?activeTab=versions -->
|
|
30
44
|
<script src="https://cdn.cidaas.de/javascript/oidc/<version>/cidaas-javascript-sdk.min.js"></script>
|
|
31
45
|
```
|
|
32
46
|
|
|
@@ -36,11 +50,9 @@ From npm
|
|
|
36
50
|
npm install cidaas-javascript-sdk
|
|
37
51
|
```
|
|
38
52
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
#### Initialisation
|
|
53
|
+
### Initialisation
|
|
42
54
|
|
|
43
|
-
After adding
|
|
55
|
+
After adding the sdk library, create a local file such as **cidaas.service.ts** and define Cidaas options variable there for initializing cidaas sdk.
|
|
44
56
|
|
|
45
57
|
Cidaas options variable support every [OIDC Client UserManagerSettings Properties](https://authts.github.io/oidc-client-ts/interfaces/UserManagerSettings.html) which has the following notable properties:
|
|
46
58
|
|
|
@@ -50,75 +62,39 @@ Cidaas options variable support every [OIDC Client UserManagerSettings Propertie
|
|
|
50
62
|
| client_id | yes | client application's identifier, which could be found in cidaas admin ui |
|
|
51
63
|
| redirect_uri | yes | URL to be redirected after successful login attempt. |
|
|
52
64
|
| post_logout_redirect_uri | no | URL to be redirected after successful logout attempt. |
|
|
53
|
-
| response_type | no | The type of response that will come after successful login attempt. The default value is 'code' if no properties is being sent. This determines the OAuth authorization flow being used.|
|
|
54
65
|
| scope | no | the scope the application requires and requests from cidaas. The default value is 'openid' if no properties is being sent. |
|
|
55
66
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
| Property Name | Required | Description |
|
|
59
|
-
| ------ | ------ | ------ |
|
|
60
|
-
| cidaas_version | no | You can find out the cidaas version from cidaas service portal |
|
|
61
|
-
| mode | no | Define which login variants to be called during calling loginWithBrowser(). The selection includes: `redirect`, `window` and `silent`. The default value is `redirect` if no properties is being sent. |
|
|
62
|
-
|
|
63
|
-
an example of index.js is looks like this:
|
|
67
|
+
an example of Cidaas options variable looks like this:
|
|
64
68
|
|
|
65
69
|
```js
|
|
66
|
-
|
|
70
|
+
const options = {
|
|
67
71
|
authority: 'your domain base url',
|
|
68
72
|
client_id: 'your app id',
|
|
69
73
|
redirect_uri: 'your redirect url',
|
|
70
74
|
post_logout_redirect_uri: 'your post logout redirect url',
|
|
71
|
-
response_type: 'id_token token',
|
|
72
75
|
scope: 'openid email roles profile',
|
|
73
|
-
mode: 'redirect',
|
|
74
|
-
cidaas_version: 3
|
|
75
76
|
}
|
|
76
77
|
```
|
|
77
78
|
|
|
78
|
-
```
|
|
79
|
-
#### <i class="fab fa-quote-left fa-fw" aria-hidden="true"></i> To use the PKCE Flow add 'code' as the 'response_type'
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Note:
|
|
83
|
-
|
|
84
|
-
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.
|
|
85
|
-
|
|
86
79
|
### Initialise the cidaas sdk using the configured options mentioned above:
|
|
87
80
|
|
|
88
81
|
```js
|
|
89
|
-
|
|
82
|
+
const cidaas = new CidaasSDK.WebAuth(options);
|
|
90
83
|
```
|
|
91
84
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
Cidaas V3 has response handling adjustment on some of cidaas service call. To migrate to cidaas V3, you need to do the following:
|
|
95
|
-
|
|
96
|
-
- ensure that you use at least cidaas version: 3.* You can find out the cidaas version from cidaas service portal and ask our customer service if it need to be updated.
|
|
97
|
-
|
|
98
|
-
- ensure that you use at least cidaas-javascript-sdk version: 3.0.5
|
|
99
|
-
|
|
100
|
-
- add `cidaas_version: 3` to Cidaas options variable
|
|
101
|
-
|
|
102
|
-
Without Providing CidaasVersion, your application will use response handling of Cidaas V2 by default.
|
|
85
|
+
### Usage
|
|
103
86
|
|
|
104
|
-
####
|
|
87
|
+
#### Login With Browser
|
|
105
88
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
The below methods will applicable for using cidaas hosted pages only.
|
|
109
|
-
|
|
110
|
-
##### Login With Browser
|
|
111
|
-
|
|
112
|
-
To login through cidaas sdk, call ****loginWithBrowser()****. This will redirect you to the hosted login page.
|
|
89
|
+
To login through cidaas sdk, call **loginWithBrowser()**. This will redirect you to the hosted login page.
|
|
113
90
|
|
|
114
91
|
```js
|
|
115
92
|
cidaas.loginWithBrowser();
|
|
116
93
|
```
|
|
117
94
|
|
|
95
|
+
once login is successful, it will automatically redirects you to redirect_uri you have configured in cidaas options. You will get information such as code & state as redirect url parameter (query or fragment), which is needed to get access token.
|
|
118
96
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
To complete the login process, call ****logincallback()****. This will parses the access_token, id_token and whatever in hash in the redirect url.
|
|
97
|
+
To complete the login process, call **logincallback()**.
|
|
122
98
|
|
|
123
99
|
```js
|
|
124
100
|
cidaas.loginCallback().then(function(response) {
|
|
@@ -128,2482 +104,94 @@ cidaas.loginCallback().then(function(response) {
|
|
|
128
104
|
});
|
|
129
105
|
```
|
|
130
106
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
To register through cidaas sdk, call ****registerWithBrowser()****. This will redirect you to the hosted registration page.
|
|
134
|
-
|
|
135
|
-
```js
|
|
136
|
-
cidaas.registerWithBrowser();
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
##### Getting UserInfo
|
|
141
|
-
|
|
142
|
-
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.
|
|
143
|
-
```js
|
|
144
|
-
cidaas.getUserInfo().then(function (response) {
|
|
145
|
-
// the response will give you profile details.
|
|
146
|
-
}).catch(function(ex) {
|
|
147
|
-
// your failure code here
|
|
148
|
-
});;
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
##### Logout
|
|
153
|
-
|
|
154
|
-
```js
|
|
155
|
-
cidaas.logout().then(function () {
|
|
156
|
-
// your logout success code here
|
|
157
|
-
}).catch(function(ex) {
|
|
158
|
-
// your failure code here
|
|
159
|
-
});
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
If you use the logout method, you need set the redirect url, if not it will automatically redirect to the login page
|
|
163
|
-
|
|
164
|
-
#### Native SDK methods
|
|
165
|
-
|
|
166
|
-
The below methods will be applicable for only native support
|
|
167
|
-
|
|
168
|
-
#### Login and Registration
|
|
169
|
-
|
|
170
|
-
##### Getting RequestId
|
|
171
|
-
|
|
172
|
-
Each and every proccesses starts with requestId, it is an entry point to login or register. For getting the requestId, call ****getRequestId()****.
|
|
173
|
-
|
|
174
|
-
##### Sample code
|
|
175
|
-
|
|
176
|
-
```js
|
|
177
|
-
cidaas.getRequestId().then(function (response) {
|
|
178
|
-
// the response will give you request ID.
|
|
179
|
-
}).catch(function(ex) {
|
|
180
|
-
// your failure code here
|
|
181
|
-
});
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
##### Response
|
|
185
|
-
```json
|
|
186
|
-
{
|
|
187
|
-
"success":true,
|
|
188
|
-
"status":200,
|
|
189
|
-
"data": {
|
|
190
|
-
"groupname":"default",
|
|
191
|
-
"lang":"en,en-US;q=0.9,de-DE;q=0.8,de;q=0.7",
|
|
192
|
-
"view_type":"login",
|
|
193
|
-
"requestId":"5cbcedfb-0d57-4097-993c-32db5cf94654"
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
##### Getting Tenant Info
|
|
199
|
-
|
|
200
|
-
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).
|
|
201
|
-
|
|
202
|
-
##### Sample code
|
|
203
|
-
```js
|
|
204
|
-
cidaas.getTenantInfo().then(function (response) {
|
|
205
|
-
// the response will give you tenent details.
|
|
206
|
-
}).catch(function(ex) {
|
|
207
|
-
// your failure code here
|
|
208
|
-
});
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
##### Response
|
|
212
|
-
|
|
213
|
-
```json
|
|
214
|
-
{
|
|
215
|
-
"success":true,
|
|
216
|
-
"status":200,
|
|
217
|
-
"data": {
|
|
218
|
-
"tenant_name":"Cidaas Developers",
|
|
219
|
-
"allowLoginWith": [
|
|
220
|
-
"EMAIL",
|
|
221
|
-
"MOBILE",
|
|
222
|
-
"USER_NAME"
|
|
223
|
-
]
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
##### Get Client Info
|
|
229
|
-
|
|
230
|
-
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).
|
|
231
|
-
|
|
232
|
-
##### Sample code
|
|
233
|
-
```js
|
|
234
|
-
cidaas.getClientInfo({
|
|
235
|
-
requestId: 'your requestId',
|
|
236
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
237
|
-
}).then(function (resp) {
|
|
238
|
-
// the response will give you client info.
|
|
239
|
-
}).catch(function(ex) {
|
|
240
|
-
// your failure code here
|
|
241
|
-
});
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
##### Response
|
|
245
|
-
```json
|
|
246
|
-
{
|
|
247
|
-
"success":true,
|
|
248
|
-
"status":200,
|
|
249
|
-
"data": {
|
|
250
|
-
"passwordless_enabled":true,
|
|
251
|
-
"logo_uri":"https://www.cidaas.com/wp-content/uploads/2018/02/logo-black.png",
|
|
252
|
-
"login_providers": [
|
|
253
|
-
"facebook",
|
|
254
|
-
"google",
|
|
255
|
-
"linkedin"
|
|
256
|
-
],
|
|
257
|
-
"policy_uri":"",
|
|
258
|
-
"tos_uri":"",
|
|
259
|
-
"client_name":"Single Page WebApp"
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
##### Login with credentials
|
|
265
|
-
|
|
266
|
-
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. Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/5gphdk6vapp56-classic-login#call-login-api for more detials.
|
|
267
|
-
|
|
268
|
-
##### Sample code
|
|
269
|
-
```js
|
|
270
|
-
cidaas.loginWithCredentials({
|
|
271
|
-
username: 'xxxx@gmail.com',
|
|
272
|
-
username_type: 'email',
|
|
273
|
-
password: '123456',
|
|
274
|
-
requestId: 'your requestId',
|
|
275
|
-
});
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
#### Login with credentials and get response
|
|
279
|
-
To login with username and password, call **loginWithCredentialsAsynFn()**. The function accepts a function parameter of type object. In the sample example the object is named as options. Below are the key that need to be passed in the options object
|
|
280
|
-
|
|
281
|
-
| Name | Type | Description | Is optional |
|
|
282
|
-
| ---- | ---- | ----------- | ----------- |
|
|
283
|
-
| request_id | string | request id of the session | false |
|
|
284
|
-
| username | string | the username of the user | false |
|
|
285
|
-
| password | string | password to authenticate the username | false |
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
##### Sample code
|
|
289
|
-
|
|
290
|
-
```js
|
|
291
|
-
options = {
|
|
292
|
-
request_id: "bGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
|
|
293
|
-
username: "test@cidaas.de"
|
|
294
|
-
password: "cidaas"
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
cidaas.loginWithCredentialsAsynFn(options)
|
|
298
|
-
.then(function (response) {
|
|
299
|
-
// type your code here
|
|
300
|
-
})
|
|
301
|
-
.catch(function (ex) {
|
|
302
|
-
// your failure code here
|
|
303
|
-
});
|
|
304
|
-
```
|
|
305
|
-
|
|
306
|
-
##### Login with social
|
|
307
|
-
|
|
308
|
-
To login with social providers, call ****loginWithSocial()****. This will redirect you to the facebook login page. Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/9mi5uqxhqlsm5-social-login#call-social-login-api for more details
|
|
309
|
-
|
|
310
|
-
##### Sample code
|
|
311
|
-
```js
|
|
312
|
-
cidaas.loginWithSocial({
|
|
313
|
-
provider: 'facebook',
|
|
314
|
-
requestId: 'your requestId',
|
|
315
|
-
});
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
##### Getting Registration Fields
|
|
319
|
-
|
|
320
|
-
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.
|
|
321
|
-
|
|
322
|
-
##### Sample code
|
|
323
|
-
```js
|
|
324
|
-
cidaas.getRegistrationSetup({
|
|
325
|
-
requestId: 'your requestId',
|
|
326
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
327
|
-
}).then(function (resp) {
|
|
328
|
-
// the response will give you fields that are required.
|
|
329
|
-
}).catch(function(ex) {
|
|
330
|
-
// your failure code here
|
|
331
|
-
});
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
##### Response
|
|
335
|
-
```json
|
|
336
|
-
{
|
|
337
|
-
"success": true,
|
|
338
|
-
"status": 200,
|
|
339
|
-
"data": [
|
|
340
|
-
{
|
|
341
|
-
"dataType": "EMAIL",
|
|
342
|
-
"fieldGroup": "DEFAULT",
|
|
343
|
-
"isGroupTitle": false,
|
|
344
|
-
"fieldKey": "email",
|
|
345
|
-
"fieldType": "SYSTEM",
|
|
346
|
-
"order": 1,
|
|
347
|
-
"readOnly": false,
|
|
348
|
-
"required": true,
|
|
349
|
-
"fieldDefinition": {},
|
|
350
|
-
"localeText": {
|
|
351
|
-
"locale": "en-us",
|
|
352
|
-
"language": "en",
|
|
353
|
-
"name": "Email",
|
|
354
|
-
"verificationRequired": "Given Email is not verified.",
|
|
355
|
-
"required": "Email is Required"
|
|
356
|
-
}
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
"dataType": "TEXT",
|
|
360
|
-
"fieldGroup": "DEFAULT",
|
|
361
|
-
"isGroupTitle": false,
|
|
362
|
-
"fieldKey": "given_name",
|
|
363
|
-
"fieldType": "SYSTEM",
|
|
364
|
-
"order": 2,
|
|
365
|
-
"readOnly": false,
|
|
366
|
-
"required": true,
|
|
367
|
-
"fieldDefinition": {
|
|
368
|
-
"maxLength": 150
|
|
369
|
-
},
|
|
370
|
-
"localeText": {
|
|
371
|
-
"maxLength": "Givenname cannot be more than 150 chars",
|
|
372
|
-
"required": "Given Name is Required",
|
|
373
|
-
"name": "Given Name",
|
|
374
|
-
"language": "en",
|
|
375
|
-
"locale": "en-us"
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
{
|
|
379
|
-
"dataType": "TEXT",
|
|
380
|
-
"fieldGroup": "DEFAULT",
|
|
381
|
-
"isGroupTitle": false,
|
|
382
|
-
"fieldKey": "family_name",
|
|
383
|
-
"fieldType": "SYSTEM",
|
|
384
|
-
"order": 3,
|
|
385
|
-
"readOnly": false,
|
|
386
|
-
"required": true,
|
|
387
|
-
"fieldDefinition": {
|
|
388
|
-
"maxLength": 150
|
|
389
|
-
}
|
|
390
|
-
},
|
|
391
|
-
{
|
|
392
|
-
"dataType": "MOBILE",
|
|
393
|
-
"fieldGroup": "DEFAULT",
|
|
394
|
-
"isGroupTitle": false,
|
|
395
|
-
"fieldKey": "mobile_number",
|
|
396
|
-
"fieldType": "SYSTEM",
|
|
397
|
-
"order": 6,
|
|
398
|
-
"readOnly": false,
|
|
399
|
-
"required": false,
|
|
400
|
-
"fieldDefinition": {
|
|
401
|
-
"verificationRequired": true
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
]
|
|
405
|
-
}
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
##### Register user
|
|
409
|
-
|
|
410
|
-
Once registration fields are getting, then design your customized UI and to register user call ****register()****. This method will create a new user.
|
|
411
|
-
|
|
412
|
-
##### Sample code
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
Note: Only requestId in the headers is required.
|
|
417
|
-
|
|
418
|
-
```js
|
|
419
|
-
let headers = {
|
|
420
|
-
requestId: your_received_requestId,
|
|
421
|
-
captcha: captcha,
|
|
422
|
-
acceptlanguage: acceptlanguage,
|
|
423
|
-
bot_captcha_response: bot_captcha_response
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
cidaas.register({
|
|
427
|
-
email: 'xxx123@xxx.com',
|
|
428
|
-
given_name: 'xxxxx',
|
|
429
|
-
family_name: 'yyyyy',
|
|
430
|
-
password: '123456',
|
|
431
|
-
password_echo: '123456',
|
|
432
|
-
provider: 'your provider', // FACEBOOK, GOOGLE, SELF
|
|
433
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
434
|
-
}, headers).then(function (response) {
|
|
435
|
-
// the response will give you client registration details.
|
|
436
|
-
}).catch(function(ex) {
|
|
437
|
-
// your failure code here
|
|
438
|
-
});
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
##### Response
|
|
442
|
-
```json
|
|
443
|
-
{
|
|
444
|
-
"success": true,
|
|
445
|
-
"status": 200,
|
|
446
|
-
"data": {
|
|
447
|
-
"sub": "7dfb2122-fa5e-4f7a-8494-dadac9b43f9d",
|
|
448
|
-
"userStatus": "VERIFIED",
|
|
449
|
-
"email_verified": false,
|
|
450
|
-
"suggested_action": "LOGIN"
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
```
|
|
454
|
-
|
|
455
|
-
##### Register with social
|
|
456
|
-
|
|
457
|
-
To register with social providers, call ****registerWithSocial()****. This will redirect you to the facebook login page.
|
|
458
|
-
|
|
459
|
-
##### Sample code
|
|
460
|
-
|
|
461
|
-
Note: giving the queryParams is not required.
|
|
462
|
-
|
|
463
|
-
```js
|
|
464
|
-
queryParams = {
|
|
465
|
-
dc: dc,
|
|
466
|
-
device_fp: device_fp
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
cidaas.registerWithSocial({
|
|
470
|
-
provider: 'facebook',
|
|
471
|
-
requestId: 'your requestId',
|
|
472
|
-
}, queryParams);
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
##### Get Missing Fields
|
|
476
|
-
|
|
477
|
-
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()****.
|
|
478
|
-
|
|
479
|
-
##### Sample code
|
|
480
|
-
|
|
481
|
-
```js
|
|
482
|
-
cidaas.getMissingFields({
|
|
483
|
-
trackId: 'your trackId', // which you will get it from url
|
|
484
|
-
requestId: 'your requestId', // which you will get it from url
|
|
485
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
486
|
-
}).then(function (response) {
|
|
487
|
-
// the response will give you user info with missing fields.
|
|
488
|
-
}).catch(function (ex) {
|
|
489
|
-
// your failure code here
|
|
490
|
-
});
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
##### Progressive Registration
|
|
494
|
-
For progressive registration, call **progressiveRegistration()**. While logging in If the API returns 417 with the error message MissingRequiredFields, call the **getMissingFieldsLogin** to get the list of missing fileds and proceed with progressive registration. In the sample request only the required fields are added, however you must provide the missing fields along with the required fields.
|
|
495
|
-
|
|
496
|
-
##### Function parameters
|
|
497
|
-
| Name | Type | Description |
|
|
498
|
-
| ---- | ---- | ----------- |
|
|
499
|
-
| options | object | The object with the keys described in the below table under section options |
|
|
500
|
-
| headers | object | The object with the keys described in the below table under section headers |
|
|
501
|
-
|
|
502
|
-
##### options
|
|
503
|
-
|
|
504
|
-
| Key name | Type | Description | Is optional |
|
|
505
|
-
| ---- | ---- | ----------- | ----------- |
|
|
506
|
-
| acceptlanguage | string | your locale/browser local | true |
|
|
507
|
-
|
|
508
|
-
* Please provide provide the missing fields along with the required fields
|
|
509
|
-
|
|
510
|
-
##### headers
|
|
511
|
-
|
|
512
|
-
| Key name | Type | Description | Is optional |
|
|
513
|
-
| ---- | ---- | ----------- | ----------- |
|
|
514
|
-
| trackId | string | the track id received while logging in | false |
|
|
515
|
-
| requestId | string | request id of the session | false |
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
##### Sample code
|
|
519
|
-
|
|
520
|
-
```js
|
|
521
|
-
options = {
|
|
522
|
-
acceptlanguage: 'en-Us'
|
|
523
|
-
}
|
|
524
|
-
|
|
525
|
-
headers = {
|
|
526
|
-
trackId: 'bGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
527
|
-
requestId: 'bGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9',
|
|
528
|
-
}
|
|
529
|
-
cidaas.progressiveRegistration(options, headers)
|
|
530
|
-
.then(function (response) {
|
|
531
|
-
// type your code here
|
|
532
|
-
})
|
|
533
|
-
.catch(function (ex) {
|
|
534
|
-
// your failure code here
|
|
535
|
-
})
|
|
536
|
-
```
|
|
537
|
-
|
|
538
|
-
##### Get Missing Fields Login
|
|
539
|
-
To get the missing fields after login, call **getMissingFieldsLogin()**.
|
|
540
|
-
|
|
541
|
-
##### Function parameters
|
|
542
|
-
| Name | Type | Description |
|
|
543
|
-
| ---- | ---- | ----------- |
|
|
544
|
-
| trackId | string | the track id received while logging in |
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
##### Sample code
|
|
548
|
-
|
|
549
|
-
```js
|
|
550
|
-
let trackId = 'bGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9';
|
|
551
|
-
cidaas.getMissingFieldsLogin(trackId)
|
|
552
|
-
.then(function (response) {
|
|
553
|
-
// type your code here
|
|
554
|
-
})
|
|
555
|
-
.catch(function (ex) {
|
|
556
|
-
// your failure code here
|
|
557
|
-
});
|
|
558
|
-
```
|
|
559
|
-
|
|
560
|
-
#### Account Verification
|
|
561
|
-
|
|
562
|
-
##### Get Communication Status
|
|
563
|
-
|
|
564
|
-
Once registration successful, verify the account based on the flow. To get the details, call ****getCommunicationStatus()****.
|
|
565
|
-
|
|
566
|
-
##### Sample code
|
|
567
|
-
|
|
568
|
-
```js
|
|
569
|
-
cidaas.getCommunicationStatus({
|
|
570
|
-
sub: 'your sub', // which you will get on the registration response
|
|
571
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
572
|
-
}).then(function (response) {
|
|
573
|
-
// the response will give you account details once its verified.
|
|
574
|
-
}).catch(function(ex) {
|
|
575
|
-
// your failure code here
|
|
576
|
-
});
|
|
577
|
-
```
|
|
578
|
-
|
|
579
|
-
##### Response
|
|
580
|
-
```json
|
|
581
|
-
{
|
|
582
|
-
"success": true,
|
|
583
|
-
"status": 200,
|
|
584
|
-
"data": {
|
|
585
|
-
"EMAIL": false,
|
|
586
|
-
"MOBILE": false,
|
|
587
|
-
"USER_NAME": true
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
```
|
|
591
|
-
|
|
592
|
-
##### Intiate Account Verification
|
|
593
|
-
|
|
594
|
-
To initiate the account verification, call ****initiateAccountVerification()****. This will send verification code email or sms or ivr based on the verificationMedium you mentioned.
|
|
595
|
-
|
|
596
|
-
##### Sample code
|
|
597
|
-
```js
|
|
598
|
-
cidaas.initiateAccountVerification({
|
|
599
|
-
verificationMedium: 'email',
|
|
600
|
-
requestId: 'your requestId',
|
|
601
|
-
processingType: 'CODE',
|
|
602
|
-
sub: 'your sub'
|
|
603
|
-
}).then(function (response) {
|
|
604
|
-
// the response will give you account verification details.
|
|
605
|
-
}).catch(function(ex) {
|
|
606
|
-
// your failure code here
|
|
607
|
-
});
|
|
608
|
-
```
|
|
609
|
-
|
|
610
|
-
##### Response
|
|
611
|
-
```json
|
|
612
|
-
{
|
|
613
|
-
"success": true,
|
|
614
|
-
"status": 200,
|
|
615
|
-
"data": {
|
|
616
|
-
"accvid": "32aca19a-c83a-4ea5-979e-f8242605bcd4"
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
```
|
|
620
|
-
|
|
621
|
-
##### Authenticate Account Verification
|
|
622
|
-
|
|
623
|
-
To complete the verification, call ****verifyAccount()****.
|
|
624
|
-
|
|
625
|
-
##### Sample code
|
|
626
|
-
```js
|
|
627
|
-
cidaas.verifyAccount({
|
|
628
|
-
accvid: 'your accvid', // which you will get on initiate account verification response
|
|
629
|
-
code: 'your code in email or sms or ivr'
|
|
630
|
-
}).then(function (response) {
|
|
631
|
-
// the response will give you account verification ID and unique code.
|
|
632
|
-
}).catch(function(ex) {
|
|
633
|
-
// your failure code here
|
|
634
|
-
});
|
|
635
|
-
```
|
|
636
|
-
|
|
637
|
-
#### Resetting your password
|
|
638
|
-
|
|
639
|
-
##### Initiate Reset Password
|
|
640
|
-
|
|
641
|
-
To initiate the password resetting, call ****initiateResetPassword()****. This will send verification code to your email or mobile based on the resetMedium you mentioned. Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/6b29bac6002f4-initiate-password-reset for more details.
|
|
642
|
-
|
|
643
|
-
##### Sample code
|
|
644
|
-
|
|
645
|
-
```js
|
|
646
|
-
cidaas.initiateResetPassword({
|
|
647
|
-
email: 'xxxxxx@xxx.com',
|
|
648
|
-
processingType: 'CODE',
|
|
649
|
-
requestId: 'your requestId',
|
|
650
|
-
resetMedium: 'email'
|
|
651
|
-
}).then(function (response) {
|
|
652
|
-
// the response will give you password reset details.
|
|
653
|
-
}).catch(function(ex) {
|
|
654
|
-
// your failure code here
|
|
655
|
-
});
|
|
656
|
-
```
|
|
657
|
-
|
|
658
|
-
##### Response
|
|
659
|
-
```json
|
|
660
|
-
{
|
|
661
|
-
"success": true,
|
|
662
|
-
"status": 200,
|
|
663
|
-
"data": {
|
|
664
|
-
"reset_initiated": true,
|
|
665
|
-
"rprq": "e98b2451-f1ca-4c81-b5e0-0ef85bb49a05"
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
```
|
|
669
|
-
|
|
670
|
-
##### Handle Reset Password
|
|
671
|
-
|
|
672
|
-
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. More details available on https://docs.cidaas.com/docs/cidaas-iam/4aede115e5460-validate-reset-password
|
|
107
|
+
After successful loginCallback, You will get access token, along with id token and refresh token in the json response, depends on your application configuration.
|
|
673
108
|
|
|
674
|
-
|
|
675
|
-
```js
|
|
676
|
-
cidaas.handleResetPassword({
|
|
677
|
-
code: 'your code in email or sms or ivr',
|
|
678
|
-
resetRequestId: 'your resetRequestId' // which you will get on initiate reset password response
|
|
679
|
-
}).then(function (response) {
|
|
680
|
-
// the response will give you valid verification code.
|
|
681
|
-
}).catch(function(ex) {
|
|
682
|
-
// your failure code here
|
|
683
|
-
});
|
|
684
|
-
```
|
|
685
|
-
|
|
686
|
-
##### Response
|
|
687
|
-
```json
|
|
688
|
-
{
|
|
689
|
-
"success": true,
|
|
690
|
-
"status": 200,
|
|
691
|
-
"data": {
|
|
692
|
-
"exchangeId": "d5ee97cd-2454-461d-8e42-554371a15c00",
|
|
693
|
-
"resetRequestId": "1834130e-7f53-4861-99d3-7f934fbba179"
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
```
|
|
109
|
+
There are code documentations for each of the functions with example code of how to call them individually.
|
|
697
110
|
|
|
698
|
-
|
|
111
|
+
### Functions Overview
|
|
699
112
|
|
|
700
|
-
|
|
113
|
+
Cidaas Javascript SDK features the following functionality:
|
|
701
114
|
|
|
702
|
-
|
|
703
|
-
```js
|
|
704
|
-
cidaas.resetPassword({
|
|
705
|
-
password: '123456',
|
|
706
|
-
confirmPassword: '123456',
|
|
707
|
-
exchangeId: 'your exchangeId', // which you will get on handle reset password response
|
|
708
|
-
resetRequestId: 'your resetRequestId' // which you will get on handle reset password response
|
|
709
|
-
}).then(function (response) {
|
|
710
|
-
// the response will give you reset password details.
|
|
711
|
-
}).catch(function(ex) {
|
|
712
|
-
// your failure code here
|
|
713
|
-
});
|
|
714
|
-
```
|
|
115
|
+
#### Authentication Functions
|
|
715
116
|
|
|
716
|
-
|
|
717
|
-
```json
|
|
718
|
-
{
|
|
719
|
-
"success": true,
|
|
720
|
-
"status": 200,
|
|
721
|
-
"data": {
|
|
722
|
-
"reseted": true
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
```
|
|
117
|
+
The SDK offers multiple way to authenticate user. Whether using browser redirection, in a pop up window, or in an iframe for silent sign in. The functions for authentication could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/authentication/index.ts)
|
|
726
118
|
|
|
727
|
-
|
|
119
|
+
| SDK Functions | Description |
|
|
120
|
+
|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
121
|
+
| loginWithBrowser, registerWithBrowser, loginCallback, logout, logoutCallback | The SDK support browser redirection for authenticating user. The authentication process will then happens in a new tab. This is the default authentication function of the SDK |
|
|
122
|
+
| popupSignIn, popupSignInCallback, popupSignOut, popupSignOutCallback | The SDK support using pop up window for authenticating user. The authentication process will then happens in a new popup window |
|
|
123
|
+
| silentSignIn, silentSignInCallback | The SDK support silent authentication. The authentication process will then happens in an iframe. |
|
|
728
124
|
|
|
729
|
-
|
|
125
|
+
#### Login Management
|
|
730
126
|
|
|
731
|
-
|
|
732
|
-
```js
|
|
733
|
-
cidaas.changePassword({
|
|
734
|
-
old_password: '123456',
|
|
735
|
-
new_password: '123456789',
|
|
736
|
-
confirm_password: '123456789',
|
|
737
|
-
identityId: 'asdauet1-quwyteuqqwejh-asdjhasd',
|
|
738
|
-
}, 'your access token')
|
|
739
|
-
.then(function () {
|
|
740
|
-
// the response will give you changed password.
|
|
741
|
-
}).catch(function (ex) {
|
|
742
|
-
// your failure code here
|
|
743
|
-
});
|
|
744
|
-
```
|
|
127
|
+
The login functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/web-auth/LoginService.ts). The SDK support the following login management functions:
|
|
745
128
|
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
"data": {
|
|
752
|
-
"changed": true
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
```
|
|
129
|
+
| SDK Functions | Description |
|
|
130
|
+
|----------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
131
|
+
| passwordlessLogin, loginWithCredentials, loginWithSocial | User could authenticate themselves using passwordless authentication, classic password credentials, as well as using social provider such as google or social media platform |
|
|
132
|
+
| loginPrecheck, consentContinue, firstTimeChangePassword, mfaContinue | Depending on the missing information from loginPrecheck, user will be redirected to another page after login to either accepting consent, changing password, continuing MFA process, or do progressive registration |
|
|
133
|
+
| getMissingFields, progressiveRegistration | In case a new required field is added in registration settings, it is possible to use the sdk to inform user of the changes and asked them to fill in the missing required fields by the next login |
|
|
756
134
|
|
|
757
|
-
####
|
|
135
|
+
#### User Management
|
|
758
136
|
|
|
759
|
-
|
|
137
|
+
The user functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/web-auth/UserService.ts). The SDK support the following user management functions:
|
|
760
138
|
|
|
761
|
-
|
|
139
|
+
| SDK Functions | Description |
|
|
140
|
+
|-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
141
|
+
| getRegistrationSetup, register, registerWithSocial | Registering a new user is possible by using classic registration (getting registration fields information & call register function) or by using social provider |
|
|
142
|
+
| getUserProfile, getInviteUserDetails, getCommunicationStatus, updateProfile, updateProfileImage, deleteUserAccount, userCheckExists | To maintain user, functions for getting user information by using cidaas internal api, updating user information, removing user, as well as check if user exist are supported |
|
|
143
|
+
| getUserInfo | The SDK could be used to get user information by using oidc client ts library |
|
|
144
|
+
| getUserActivities | In case user want to see the history of his activities, getUserActivities function is provided |
|
|
145
|
+
| initiateResetPassword, handleResetPassword, resetPassword | In case user want to reset password, password reset flow is supported. From initiating the reset password, handling the code or link which has been sent to predefined medium such as email, sms & ivr, and finishing up the reset password |
|
|
146
|
+
| changePassword | In case user want to change password, changePassword function is provided |
|
|
147
|
+
| registerDeduplication, deduplicationLogin, getDeduplicationDetails | In case a new user is registered with similiar information as existing user, deduplication could be activated to either proceed with the registration, or combine the user with an existing one |
|
|
148
|
+
| initiateLinkAccount, completeLinkAccount, unlinkAccount, getLinkedUsers | Linking und unlinking user account with another account, as well as getting linked user is supported |
|
|
762
149
|
|
|
763
|
-
|
|
764
|
-
cidaas.getProfileInfo({
|
|
765
|
-
access_token: 'your access token',
|
|
766
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
767
|
-
}).then(function (response) {
|
|
768
|
-
// the response will give you user profile details.
|
|
769
|
-
}).catch(function (ex) {
|
|
770
|
-
// your failure code here
|
|
771
|
-
});
|
|
772
|
-
```
|
|
150
|
+
#### Token Management
|
|
773
151
|
|
|
774
|
-
|
|
152
|
+
The token functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/web-auth/TokenService.ts). The SDK support the following token management functions:
|
|
775
153
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
{
|
|
784
|
-
"key": "self.email",
|
|
785
|
-
"value": "testuser@gmail.com"
|
|
786
|
-
}
|
|
787
|
-
],
|
|
788
|
-
"className": "de.cidaas.management.db.UserAccounts",
|
|
789
|
-
"_id": "ac45bdda-93bf-44f1-b2ff-8465495c3417",
|
|
790
|
-
"sub": "33361c59-368b-48e3-8739-38d7ee8f7573",
|
|
791
|
-
"user_status_reason": "",
|
|
792
|
-
"userStatus": "VERIFIED",
|
|
793
|
-
"customFields": {
|
|
794
|
-
"Test_consent_HP": true,
|
|
795
|
-
"customer_number": "CN456",
|
|
796
|
-
"invoice_number": "IN456"
|
|
797
|
-
},
|
|
798
|
-
"createdTime": "2021-05-27T07:38:29.579Z",
|
|
799
|
-
"updatedTime": "2021-06-24T11:02:43.188Z",
|
|
800
|
-
"__ref": "1624532562750-69ab9fff-2a71-4a05-8d67-6886376b51d6",
|
|
801
|
-
"__v": 0,
|
|
802
|
-
"lastLoggedInTime": "2021-06-24T11:02:43.186Z",
|
|
803
|
-
"lastUsedIdentity": "bbee960d-6a80-424e-99bd-586d74f1053e",
|
|
804
|
-
"mfa_enabled": true,
|
|
805
|
-
"id": "ac45bdda-93bf-44f1-b2ff-8465495c3417"
|
|
806
|
-
},
|
|
807
|
-
"identity": {
|
|
808
|
-
"_id": "bbee960d-6a80-424e-99bd-586d74f1053e",
|
|
809
|
-
"className": "de.cidaas.core.db.EnternalSocialIdentity",
|
|
810
|
-
"sub": "33361c59-368b-48e3-8739-38d7ee8f7573",
|
|
811
|
-
"provider": "self",
|
|
812
|
-
"email": "testuser@gmail.com",
|
|
813
|
-
"email_verified": true,
|
|
814
|
-
"family_name": "Test",
|
|
815
|
-
"given_name": "User",
|
|
816
|
-
"locale": "en-us",
|
|
817
|
-
"createdTime": "2021-05-27T07:38:29.908Z",
|
|
818
|
-
"updatedTime": "2021-06-24T11:02:43.188Z",
|
|
819
|
-
"__ref": "1624532562750-69ab9fff-2a71-4a05-8d67-6886376b51d6",
|
|
820
|
-
"__v": 0,
|
|
821
|
-
"birthdate": "1993-06-07T18:30:00.000Z",
|
|
822
|
-
"id": "bbee960d-6a80-424e-99bd-586d74f1053e"
|
|
823
|
-
},
|
|
824
|
-
"customFields": {},
|
|
825
|
-
"roles": [
|
|
826
|
-
"USER"
|
|
827
|
-
],
|
|
828
|
-
"groups": []
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
```
|
|
154
|
+
| SDK Functions | Description |
|
|
155
|
+
|--------------------------------------|-----------------------------------------------------------------------------------------------------|
|
|
156
|
+
| getAccessToken | The SDK facilitate login using PKCE flow by exchanging code after succesful login with access token |
|
|
157
|
+
| renewToken | Session renewal is possible by using refresh token |
|
|
158
|
+
| initiateDeviceCode, deviceCodeVerify | Device code flow is supported for authenticating user without user interaction possibilty in device |
|
|
159
|
+
| validateAccessToken | Token validation could be done by using introspection endpoint |
|
|
160
|
+
| offlineTokenCheck | To save API call, offline token check function could be used |
|
|
832
161
|
|
|
833
|
-
####
|
|
162
|
+
#### Verification Management
|
|
834
163
|
|
|
835
|
-
|
|
164
|
+
The verification functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/web-auth/VerificationService.ts). The SDK support the following verification management functions:
|
|
836
165
|
|
|
837
|
-
|
|
|
838
|
-
|
|
839
|
-
|
|
|
840
|
-
|
|
|
166
|
+
| SDK Functions | Description |
|
|
167
|
+
|---------------------------------------------------------------------|---------------------------------------------------------------------------------------|
|
|
168
|
+
| initiateMFA, authenticateMFA | The SDK support initiating & authenticating MFA, which starts passwordless login flow |
|
|
169
|
+
| initiateAccountVerification, verifyAccount | User account verification using preconfigured MFA is supported |
|
|
170
|
+
| cancelMFA | MFA process could be aborted in case something go the wrong way |
|
|
171
|
+
| getAllVerificationList, getMFAList, checkVerificationTypeConfigured | Information about every supported MFA Verification types, List of configured MFA, and details about particular configured verification type are provided by the SDK |
|
|
172
|
+
| initiateEnrollment, enrollVerification, getEnrollmentStatus | Additional MFA verification type could be enrolled using the sdk |
|
|
841
173
|
|
|
842
|
-
|
|
843
|
-
```js
|
|
844
|
-
let options = {
|
|
845
|
-
access_token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
|
|
846
|
-
acceptlanguage: 'en-US'
|
|
847
|
-
}
|
|
848
|
-
cidaas.getUserProfile(options)
|
|
849
|
-
.then(function (response) {
|
|
850
|
-
// the response will give you user profile information.
|
|
851
|
-
}).catch(function (ex) {
|
|
852
|
-
// your failure code here
|
|
853
|
-
});
|
|
854
|
-
```
|
|
174
|
+
#### Consent Management
|
|
855
175
|
|
|
856
|
-
|
|
857
|
-
```json
|
|
858
|
-
{
|
|
859
|
-
"sub": "cc28a557-ce0d-4896-9580-49639cbde8d5",
|
|
860
|
-
"email": "davidjhonson1984@gmail.com",
|
|
861
|
-
"email_verified": true,
|
|
862
|
-
"name": "David Jhonson",
|
|
863
|
-
"family_name": "Jhonson",
|
|
864
|
-
"given_name": "David",
|
|
865
|
-
"nickname": "test",
|
|
866
|
-
"preferred_username": "davidjhonson",
|
|
867
|
-
"gender": "Male",
|
|
868
|
-
"locale": "en-us",
|
|
869
|
-
"updated_at": 1527662349,
|
|
870
|
-
"username": "davidjhonson"
|
|
871
|
-
}
|
|
872
|
-
```
|
|
176
|
+
The consent functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/web-auth/ConsentService.ts). The SDK support the following consent management functions:
|
|
873
177
|
|
|
874
|
-
|
|
178
|
+
| SDK Functions | Description |
|
|
179
|
+
|---------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------|
|
|
180
|
+
| getConsentDetails, getConsentVersionDetails | The SDK could be used to get consent details as well as details of consent's version |
|
|
181
|
+
| acceptConsent, acceptScopeConsent, acceptClaimConsent, revokeClaimConsent | The SDK support accepting consent (app level consent, scope consent or claim consent) as well as revoke claim consent |
|
|
875
182
|
|
|
876
|
-
|
|
183
|
+
#### Other Functionality
|
|
877
184
|
|
|
878
|
-
|
|
879
|
-
```js
|
|
880
|
-
cidaas.updateProfile({
|
|
881
|
-
family_name: 'Doe',
|
|
882
|
-
given_name: 'John',
|
|
883
|
-
provider: 'self',
|
|
884
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
885
|
-
}, 'your access token', 'your sub').then(function () {
|
|
886
|
-
// the response will give you updated user profile info.
|
|
887
|
-
}).catch(function (ex) {
|
|
888
|
-
// your failure code here
|
|
889
|
-
});
|
|
890
|
-
```
|
|
185
|
+
general SDK functions could be found [here](https://github.com/Cidaas/cidaas-javascript-sdk/blob/master/src/main/web-auth/WebAuth.ts). The SDK support the following other functionality:
|
|
891
186
|
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
To logout the user, call ****logoutUser()****.
|
|
902
|
-
|
|
903
|
-
##### Sample code
|
|
904
|
-
```js
|
|
905
|
-
cidaas.logoutUser({
|
|
906
|
-
access_token : 'your accessToken'
|
|
907
|
-
});
|
|
908
|
-
```
|
|
909
|
-
#### Delete User Account
|
|
910
|
-
|
|
911
|
-
To delete the user account directly in the application, call **deleteUserAccount()**. This method will delete the user account with **requestId** as the **query parameter**.
|
|
912
|
-
|
|
913
|
-
This method takes an object as input.
|
|
914
|
-
|
|
915
|
-
##### Sample code
|
|
916
|
-
|
|
917
|
-
```js
|
|
918
|
-
options = {
|
|
919
|
-
sub: "7e4f79a9-cfbc-456d-936a-e6bc1de2d4b9",
|
|
920
|
-
requestId: "7d86460b-8288-4341-aed1- 10dd27a4565c",
|
|
921
|
-
accept-language: "en",
|
|
922
|
-
access_token: "your_access_token"
|
|
923
|
-
}
|
|
924
|
-
```
|
|
925
|
-
|
|
926
|
-
The usage of the method is as follows.
|
|
927
|
-
|
|
928
|
-
```js
|
|
929
|
-
cidaas.deleteUserAccount(options).then(function (response) {
|
|
930
|
-
|
|
931
|
-
// the response will give you account details to be deleted.
|
|
932
|
-
|
|
933
|
-
}).catch(function(ex) {
|
|
934
|
-
|
|
935
|
-
// your failure code here
|
|
936
|
-
|
|
937
|
-
});
|
|
938
|
-
```
|
|
939
|
-
#### Response
|
|
940
|
-
|
|
941
|
-
```js
|
|
942
|
-
{
|
|
943
|
-
"success": true,
|
|
944
|
-
"status": 200,
|
|
945
|
-
"data": {
|
|
946
|
-
"result": true
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
```
|
|
950
|
-
|
|
951
|
-
##### User Check Exists
|
|
952
|
-
Check if user exists, call **userCheckExists()**. The function accepts a function parameter of type object. The object with the keys described in the below table
|
|
953
|
-
|
|
954
|
-
| Key name | Type | Description | Is optional |
|
|
955
|
-
| ---- | ---- | ----------- | ----------- |
|
|
956
|
-
| requestId | string | the request id of a session | false |
|
|
957
|
-
|
|
958
|
-
##### Sample code
|
|
959
|
-
|
|
960
|
-
```js
|
|
961
|
-
options = {
|
|
962
|
-
requestId : "bGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
|
|
963
|
-
}
|
|
964
|
-
cidaas.userCheckExists(options)
|
|
965
|
-
.then(function(response) {
|
|
966
|
-
// type your code here
|
|
967
|
-
})
|
|
968
|
-
.catch(function(ex) {
|
|
969
|
-
// your failure code here
|
|
970
|
-
});
|
|
971
|
-
```
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
##### Initiate account linking
|
|
975
|
-
To initiate account linking, call **initiateLinkAccount()**. The function parameters are mentioned below.
|
|
976
|
-
|
|
977
|
-
##### Function parameters
|
|
978
|
-
| Name | Type | Description | Is optional |
|
|
979
|
-
| ---- | ---- | ----------- | ----------- |
|
|
980
|
-
| options | object | an object with the keys described in the below table | false |
|
|
981
|
-
| access_token | string | the username of the user | false |
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
| Key name | Type | Description | Is optional |
|
|
985
|
-
| ---- | ---- | ----------- | ----------- |
|
|
986
|
-
| user_name_to_link | string | Username that needs to be linked | false |
|
|
987
|
-
| master_sub | string | Master sub to link account | false |
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
##### Sample code
|
|
991
|
-
|
|
992
|
-
```js
|
|
993
|
-
let options = {
|
|
994
|
-
master_sub : "vaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ",
|
|
995
|
-
user_name_to_link: "CidaasTest"
|
|
996
|
-
}
|
|
997
|
-
const acccess_token= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
|
|
998
|
-
|
|
999
|
-
cidaas.initiateLinkAccount(options,access_token)
|
|
1000
|
-
.then(function (response) {
|
|
1001
|
-
// type your code here
|
|
1002
|
-
})
|
|
1003
|
-
.catch(function (ex) {
|
|
1004
|
-
// your failure code here
|
|
1005
|
-
});
|
|
1006
|
-
```
|
|
1007
|
-
|
|
1008
|
-
##### Complete link account
|
|
1009
|
-
To complete account linking, call **completeLinkAccount()**. The function parameters are mentioned below.
|
|
1010
|
-
|
|
1011
|
-
##### Function parameters
|
|
1012
|
-
| Name | Type | Description | Is optional |
|
|
1013
|
-
| ---- | ---- | ----------- | ----------- |
|
|
1014
|
-
| options | object | an object with the keys described in the below table | false |
|
|
1015
|
-
| access_token | string | the username of the user | false |
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
| Key name | Type | Description | Is optional |
|
|
1019
|
-
| ---- | ---- | ----------- | ----------- |
|
|
1020
|
-
| link_request_id | string | the request id of account link request | false |
|
|
1021
|
-
| code | string | the code received while account linking | false |
|
|
1022
|
-
|
|
1023
|
-
##### Sample code
|
|
1024
|
-
|
|
1025
|
-
```js
|
|
1026
|
-
let options = {
|
|
1027
|
-
link_request_id : "vaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ",
|
|
1028
|
-
code: "1234567890"
|
|
1029
|
-
}
|
|
1030
|
-
const acccess_token= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
|
|
1031
|
-
|
|
1032
|
-
cidaas.completeLinkAccount(options,access_token)
|
|
1033
|
-
.then(function (response) {
|
|
1034
|
-
// type your code here
|
|
1035
|
-
})
|
|
1036
|
-
.catch(function (ex) {
|
|
1037
|
-
// your failure code here
|
|
1038
|
-
});
|
|
1039
|
-
```
|
|
1040
|
-
|
|
1041
|
-
##### Get Linked Users
|
|
1042
|
-
To get all the linked social accounts, call **getLinkedUsers()**. The function accepts the below parameters
|
|
1043
|
-
|
|
1044
|
-
##### Function parameters
|
|
1045
|
-
| Name | Type | Description | Is optional |
|
|
1046
|
-
| ---- | ---- | ----------- | ----------- |
|
|
1047
|
-
| sub | string | the sub of the user | false |
|
|
1048
|
-
| access_token | string | the username of the user | false |
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
##### Sample code
|
|
1052
|
-
|
|
1053
|
-
```js
|
|
1054
|
-
const sub = "vaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ";
|
|
1055
|
-
const acccess_token= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
|
|
1056
|
-
|
|
1057
|
-
cidaas.getLinkedUsers(access_token, sub)
|
|
1058
|
-
.then(function (response) {
|
|
1059
|
-
// type your code here
|
|
1060
|
-
})
|
|
1061
|
-
.catch(function (ex) {
|
|
1062
|
-
// your failure code here
|
|
1063
|
-
});
|
|
1064
|
-
```
|
|
1065
|
-
|
|
1066
|
-
##### Unlink Account
|
|
1067
|
-
To unlink an social account for a user, call **unlinkAccount()**. The function accepts the below parameters
|
|
1068
|
-
|
|
1069
|
-
##### Function parameters
|
|
1070
|
-
| Name | Type | Description | Is optional |
|
|
1071
|
-
| ---- | ---- | ----------- | ----------- |
|
|
1072
|
-
| identityId | string | The identity id of the account to be unlinked | false |
|
|
1073
|
-
| access_token | string | the username of the user | false |
|
|
1074
|
-
|
|
1075
|
-
##### Sample code
|
|
1076
|
-
|
|
1077
|
-
```js
|
|
1078
|
-
const identityId = "vaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ";
|
|
1079
|
-
const acccess_token= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
|
|
1080
|
-
|
|
1081
|
-
cidaas.unlinkAccount(access_token, identityId)
|
|
1082
|
-
.then(function (response) {
|
|
1083
|
-
// type your code here
|
|
1084
|
-
})
|
|
1085
|
-
.catch(function (ex) {
|
|
1086
|
-
// your failure code here
|
|
1087
|
-
});
|
|
1088
|
-
```
|
|
1089
|
-
|
|
1090
|
-
#### Physical Verification
|
|
1091
|
-
|
|
1092
|
-
After successful login, we can add multifactor authentications.
|
|
1093
|
-
|
|
1094
|
-
#### EMAIL
|
|
1095
|
-
|
|
1096
|
-
##### Setup Email
|
|
1097
|
-
|
|
1098
|
-
To configure email, call ****setupEmail()****.
|
|
1099
|
-
|
|
1100
|
-
##### Sample code
|
|
1101
|
-
```js
|
|
1102
|
-
this.cidaas.setupEmail({
|
|
1103
|
-
deviceInfo: {
|
|
1104
|
-
deviceId: 'your device id'
|
|
1105
|
-
}
|
|
1106
|
-
}).then((response) => {
|
|
1107
|
-
// the response will give you details for email setup.
|
|
1108
|
-
}).catch((err) => {
|
|
1109
|
-
// your failure code here
|
|
1110
|
-
});
|
|
1111
|
-
```
|
|
1112
|
-
|
|
1113
|
-
##### Response
|
|
1114
|
-
```json
|
|
1115
|
-
{
|
|
1116
|
-
"success":true,
|
|
1117
|
-
"status":200,
|
|
1118
|
-
"data": {
|
|
1119
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
```
|
|
1123
|
-
|
|
1124
|
-
##### Enroll Email
|
|
1125
|
-
|
|
1126
|
-
To enroll email, call ****enrollEmail()****.
|
|
1127
|
-
|
|
1128
|
-
##### Sample code
|
|
1129
|
-
```js
|
|
1130
|
-
this.cidaas.enrollEmail({
|
|
1131
|
-
statusId: 'your status id', // which you received in setup email response
|
|
1132
|
-
code: '1221234234', // which you received in email
|
|
1133
|
-
deviceInfo: {
|
|
1134
|
-
deviceId: 'your device id'
|
|
1135
|
-
}
|
|
1136
|
-
}).then((response) => {
|
|
1137
|
-
// the response will give you email and device info to be linked.
|
|
1138
|
-
}).catch((err) => {
|
|
1139
|
-
// your failure code here
|
|
1140
|
-
});
|
|
1141
|
-
```
|
|
1142
|
-
|
|
1143
|
-
##### Response
|
|
1144
|
-
```json
|
|
1145
|
-
{
|
|
1146
|
-
"success":true,
|
|
1147
|
-
"status":200,
|
|
1148
|
-
"data": {
|
|
1149
|
-
"sub":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
|
|
1150
|
-
"trackingCode": "75hafysd7-5f5cbb84-4ceb-4975-b347-4bfac61e92"
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
```
|
|
1154
|
-
|
|
1155
|
-
##### Initiate Email
|
|
1156
|
-
|
|
1157
|
-
To send a verification code to email, call ****initiateEmail()****.
|
|
1158
|
-
|
|
1159
|
-
##### Sample code
|
|
1160
|
-
```js
|
|
1161
|
-
this.cidaas.initiateEmail({
|
|
1162
|
-
sub: 'your sub',
|
|
1163
|
-
physicalVerificationId: 'your physical verification id',
|
|
1164
|
-
userDeviceId: deviceId,
|
|
1165
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1166
|
-
deviceInfo: {
|
|
1167
|
-
deviceId: 'your device id'
|
|
1168
|
-
}
|
|
1169
|
-
}).then((response) => {
|
|
1170
|
-
// the response will give you email verification code details.
|
|
1171
|
-
}).catch((err) => {
|
|
1172
|
-
// your failure code here
|
|
1173
|
-
});
|
|
1174
|
-
```
|
|
1175
|
-
|
|
1176
|
-
##### Response
|
|
1177
|
-
```json
|
|
1178
|
-
{
|
|
1179
|
-
"success":true,
|
|
1180
|
-
"status":200,
|
|
1181
|
-
"data": {
|
|
1182
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
```
|
|
1186
|
-
|
|
1187
|
-
##### Authenticate Email
|
|
1188
|
-
|
|
1189
|
-
To verify the code, call ****authenticateEmail()****.
|
|
1190
|
-
|
|
1191
|
-
##### Sample code
|
|
1192
|
-
```js
|
|
1193
|
-
this.cidaas.authenticateEmail({
|
|
1194
|
-
verifierPassword: 'your generated otp', // received in Email
|
|
1195
|
-
code: 'your generated otp', // received in Email
|
|
1196
|
-
statusId: 'your status id', // received from initiate call
|
|
1197
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1198
|
-
deviceInfo: {
|
|
1199
|
-
deviceId: 'your device id'
|
|
1200
|
-
}
|
|
1201
|
-
}).then((response) => {
|
|
1202
|
-
// the response will give you email authentication details.
|
|
1203
|
-
}).catch((err) => {
|
|
1204
|
-
// your failure code here
|
|
1205
|
-
});
|
|
1206
|
-
```
|
|
1207
|
-
|
|
1208
|
-
##### Response
|
|
1209
|
-
```json
|
|
1210
|
-
{
|
|
1211
|
-
"success":true,
|
|
1212
|
-
"status":200,
|
|
1213
|
-
"data": {
|
|
1214
|
-
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1215
|
-
}
|
|
1216
|
-
}
|
|
1217
|
-
```
|
|
1218
|
-
|
|
1219
|
-
#### SMS
|
|
1220
|
-
|
|
1221
|
-
##### Setup SMS
|
|
1222
|
-
|
|
1223
|
-
To configure SMS, call ****setupSMS()****.
|
|
1224
|
-
|
|
1225
|
-
##### Sample code
|
|
1226
|
-
```js
|
|
1227
|
-
this.cidaas.setupSMS({
|
|
1228
|
-
deviceInfo: {
|
|
1229
|
-
deviceId: 'your device id'
|
|
1230
|
-
}
|
|
1231
|
-
}).then((response) => {
|
|
1232
|
-
// the response will give you details for SMS setup.
|
|
1233
|
-
}).catch((err) => {
|
|
1234
|
-
// your failure code here
|
|
1235
|
-
});
|
|
1236
|
-
```
|
|
1237
|
-
|
|
1238
|
-
##### Response
|
|
1239
|
-
```json
|
|
1240
|
-
{
|
|
1241
|
-
"success":true,
|
|
1242
|
-
"status":200,
|
|
1243
|
-
"data": {
|
|
1244
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1245
|
-
}
|
|
1246
|
-
}
|
|
1247
|
-
```
|
|
1248
|
-
|
|
1249
|
-
##### Enroll SMS
|
|
1250
|
-
|
|
1251
|
-
To enroll SMS, call ****enrollSMS()****.
|
|
1252
|
-
|
|
1253
|
-
##### Sample code
|
|
1254
|
-
```js
|
|
1255
|
-
this.cidaas.enrollSMS({
|
|
1256
|
-
statusId: 'your status id', // which you received in setup sms response
|
|
1257
|
-
code: '1221234234', // which you received via sms
|
|
1258
|
-
deviceInfo: {
|
|
1259
|
-
deviceId: 'your device id'
|
|
1260
|
-
}
|
|
1261
|
-
}).then((response) => {
|
|
1262
|
-
// the response will give you SMS and device info to be linked
|
|
1263
|
-
}).catch((err) => {
|
|
1264
|
-
// your failure code here
|
|
1265
|
-
});
|
|
1266
|
-
```
|
|
1267
|
-
|
|
1268
|
-
##### Response
|
|
1269
|
-
```json
|
|
1270
|
-
{
|
|
1271
|
-
"success":true,
|
|
1272
|
-
"status":200,
|
|
1273
|
-
"data": {
|
|
1274
|
-
"sub":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
|
|
1275
|
-
"trackingCode": "75hafysd7-5f5cbb84-4ceb-4975-b347-4bfac61e92"
|
|
1276
|
-
}
|
|
1277
|
-
}
|
|
1278
|
-
```
|
|
1279
|
-
|
|
1280
|
-
##### Initiate SMS
|
|
1281
|
-
|
|
1282
|
-
To send a verification code to sms, call ****initiateSMS()****.
|
|
1283
|
-
|
|
1284
|
-
##### Sample code
|
|
1285
|
-
```js
|
|
1286
|
-
this.cidaas.initiateSMS({
|
|
1287
|
-
sub: 'your sub',
|
|
1288
|
-
physicalVerificationId: 'your physical verification id',
|
|
1289
|
-
userDeviceId: deviceId,
|
|
1290
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1291
|
-
deviceInfo: {
|
|
1292
|
-
deviceId: 'your device id'
|
|
1293
|
-
}
|
|
1294
|
-
}).then((response) => {
|
|
1295
|
-
// the response will give you SMS verification code details.
|
|
1296
|
-
}).catch((err) => {
|
|
1297
|
-
// your failure code here
|
|
1298
|
-
});
|
|
1299
|
-
```
|
|
1300
|
-
|
|
1301
|
-
##### Response
|
|
1302
|
-
```json
|
|
1303
|
-
{
|
|
1304
|
-
"success":true,
|
|
1305
|
-
"status":200,
|
|
1306
|
-
"data": {
|
|
1307
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
```
|
|
1311
|
-
|
|
1312
|
-
##### Authenticate SMS
|
|
1313
|
-
|
|
1314
|
-
To verify the code, call ****authenticateSMS()****.
|
|
1315
|
-
|
|
1316
|
-
##### Sample code
|
|
1317
|
-
```js
|
|
1318
|
-
this.cidaas.authenticateSMS({
|
|
1319
|
-
verifierPassword: 'your generated otp', // received in SMS
|
|
1320
|
-
code: 'your generated otp', // received in SMS
|
|
1321
|
-
statusId: 'your status id', // received from initiate call
|
|
1322
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1323
|
-
deviceInfo: {
|
|
1324
|
-
deviceId: 'your device id'
|
|
1325
|
-
}
|
|
1326
|
-
}).then((response) => {
|
|
1327
|
-
// the response will give you SMS authentiction details.
|
|
1328
|
-
}).catch((err) => {
|
|
1329
|
-
// your failure code here
|
|
1330
|
-
});
|
|
1331
|
-
```
|
|
1332
|
-
|
|
1333
|
-
##### Response
|
|
1334
|
-
```json
|
|
1335
|
-
{
|
|
1336
|
-
"success":true,
|
|
1337
|
-
"status":200,
|
|
1338
|
-
"data": {
|
|
1339
|
-
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
```
|
|
1343
|
-
|
|
1344
|
-
#### IVR
|
|
1345
|
-
|
|
1346
|
-
##### Setup IVR
|
|
1347
|
-
|
|
1348
|
-
To configure IVR, call ****setupIVR()****.
|
|
1349
|
-
|
|
1350
|
-
##### Sample code
|
|
1351
|
-
```js
|
|
1352
|
-
this.cidaas.setupIVR({
|
|
1353
|
-
deviceInfo: {
|
|
1354
|
-
deviceId: 'your device id'
|
|
1355
|
-
}
|
|
1356
|
-
}).then((response) => {
|
|
1357
|
-
// the response will give you details for IVR setup.
|
|
1358
|
-
}).catch((err) => {
|
|
1359
|
-
// your failure code here
|
|
1360
|
-
});
|
|
1361
|
-
```
|
|
1362
|
-
|
|
1363
|
-
##### Response
|
|
1364
|
-
```json
|
|
1365
|
-
{
|
|
1366
|
-
"success":true,
|
|
1367
|
-
"status":200,
|
|
1368
|
-
"data": {
|
|
1369
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1370
|
-
}
|
|
1371
|
-
}
|
|
1372
|
-
```
|
|
1373
|
-
|
|
1374
|
-
##### Enroll IVR
|
|
1375
|
-
|
|
1376
|
-
To enroll IVR, call ****enrollIVR()****.
|
|
1377
|
-
|
|
1378
|
-
##### Sample code
|
|
1379
|
-
```js
|
|
1380
|
-
this.cidaas.enrollIVR({
|
|
1381
|
-
statusId: 'your status id', // which you received in setup ivr response
|
|
1382
|
-
code: '1221234234', // which you received via voice call
|
|
1383
|
-
deviceInfo: {
|
|
1384
|
-
deviceId: 'your device id'
|
|
1385
|
-
}
|
|
1386
|
-
}).then((response) => {
|
|
1387
|
-
// the response will give you IVR and device info to be linked.
|
|
1388
|
-
}).catch((err) => {
|
|
1389
|
-
// your failure code here
|
|
1390
|
-
});
|
|
1391
|
-
```
|
|
1392
|
-
|
|
1393
|
-
##### Response
|
|
1394
|
-
```json
|
|
1395
|
-
{
|
|
1396
|
-
"success":true,
|
|
1397
|
-
"status":200,
|
|
1398
|
-
"data": {
|
|
1399
|
-
"sub":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
|
|
1400
|
-
"trackingCode": "75hafysd7-5f5cbb84-4ceb-4975-b347-4bfac61e92"
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
```
|
|
1404
|
-
|
|
1405
|
-
##### Initiate IVR
|
|
1406
|
-
|
|
1407
|
-
To send a verification code to a voice call, call ****initiateIVR()****.
|
|
1408
|
-
|
|
1409
|
-
##### Sample code
|
|
1410
|
-
```js
|
|
1411
|
-
this.cidaas.initiateIVR({
|
|
1412
|
-
sub: 'your sub',
|
|
1413
|
-
physicalVerificationId: 'your physical verification id',
|
|
1414
|
-
userDeviceId: deviceId,
|
|
1415
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1416
|
-
deviceInfo: {
|
|
1417
|
-
deviceId: 'your device id'
|
|
1418
|
-
}
|
|
1419
|
-
}).then((response) => {
|
|
1420
|
-
// the response will give you IVR verification code details.
|
|
1421
|
-
}).catch((err) => {
|
|
1422
|
-
// your failure code here
|
|
1423
|
-
});
|
|
1424
|
-
```
|
|
1425
|
-
|
|
1426
|
-
##### Response
|
|
1427
|
-
```json
|
|
1428
|
-
{
|
|
1429
|
-
"success":true,
|
|
1430
|
-
"status":200,
|
|
1431
|
-
"data": {
|
|
1432
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
|
-
```
|
|
1436
|
-
|
|
1437
|
-
##### Authenticate IVR
|
|
1438
|
-
|
|
1439
|
-
To verify the code, call ****authenticateIVR()****.
|
|
1440
|
-
|
|
1441
|
-
##### Sample code
|
|
1442
|
-
```js
|
|
1443
|
-
this.cidaas.authenticateIVR({
|
|
1444
|
-
verifierPassword: 'your generated otp', // received via voice call
|
|
1445
|
-
code: 'your generated otp', // received via voice call
|
|
1446
|
-
statusId: 'your status id', // received from initiate call
|
|
1447
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1448
|
-
deviceInfo: {
|
|
1449
|
-
deviceId: 'your device id'
|
|
1450
|
-
}
|
|
1451
|
-
}).then((response) => {
|
|
1452
|
-
// the response will give you IVR authentication details.
|
|
1453
|
-
}).catch((err) => {
|
|
1454
|
-
// your failure code here
|
|
1455
|
-
});
|
|
1456
|
-
```
|
|
1457
|
-
|
|
1458
|
-
##### Response
|
|
1459
|
-
```json
|
|
1460
|
-
{
|
|
1461
|
-
"success":true,
|
|
1462
|
-
"status":200,
|
|
1463
|
-
"data": {
|
|
1464
|
-
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1465
|
-
}
|
|
1466
|
-
}
|
|
1467
|
-
```
|
|
1468
|
-
|
|
1469
|
-
#### BACKUPCODE
|
|
1470
|
-
|
|
1471
|
-
##### Setup Backupcode
|
|
1472
|
-
|
|
1473
|
-
To configure backupcode, call ****setupBackupcode()****.
|
|
1474
|
-
|
|
1475
|
-
##### Sample code
|
|
1476
|
-
```js
|
|
1477
|
-
this.cidaas.setupBackupcode({
|
|
1478
|
-
deviceInfo: {
|
|
1479
|
-
deviceId: 'your device id'
|
|
1480
|
-
}
|
|
1481
|
-
}).then((response) => {
|
|
1482
|
-
// the response will give you details for backup-code setup.
|
|
1483
|
-
}).catch((err) => {
|
|
1484
|
-
// your failure code here
|
|
1485
|
-
});
|
|
1486
|
-
```
|
|
1487
|
-
|
|
1488
|
-
##### Response
|
|
1489
|
-
```json
|
|
1490
|
-
{
|
|
1491
|
-
"success":true,
|
|
1492
|
-
"status":200,
|
|
1493
|
-
"data": {
|
|
1494
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
|
|
1495
|
-
"backupcodes": [
|
|
1496
|
-
{
|
|
1497
|
-
"statusId": "5f5cbb84-4ceb-4975-b347-4bfac61e9248",
|
|
1498
|
-
"code": "8767344",
|
|
1499
|
-
"used": false
|
|
1500
|
-
}
|
|
1501
|
-
]
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
```
|
|
1505
|
-
|
|
1506
|
-
##### Initiate Backupcode
|
|
1507
|
-
|
|
1508
|
-
To create a verification code, call ****initiateBackupcode()****.
|
|
1509
|
-
|
|
1510
|
-
##### Sample code
|
|
1511
|
-
```js
|
|
1512
|
-
this.cidaas.initiateBackupcode({
|
|
1513
|
-
sub: 'your sub',
|
|
1514
|
-
physicalVerificationId: 'your physical verification id',
|
|
1515
|
-
userDeviceId: deviceId,
|
|
1516
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1517
|
-
deviceInfo: {
|
|
1518
|
-
deviceId: 'your device id'
|
|
1519
|
-
}
|
|
1520
|
-
}).then((response) => {
|
|
1521
|
-
// the response will give you backup-code verification code details.
|
|
1522
|
-
}).catch((err) => {
|
|
1523
|
-
// your failure code here
|
|
1524
|
-
});
|
|
1525
|
-
```
|
|
1526
|
-
|
|
1527
|
-
##### Response
|
|
1528
|
-
```json
|
|
1529
|
-
{
|
|
1530
|
-
"success":true,
|
|
1531
|
-
"status":200,
|
|
1532
|
-
"data": {
|
|
1533
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1534
|
-
}
|
|
1535
|
-
}
|
|
1536
|
-
```
|
|
1537
|
-
|
|
1538
|
-
##### Authenticate Backupcode
|
|
1539
|
-
|
|
1540
|
-
To verify the code, call ****authenticateBackupcode()****.
|
|
1541
|
-
|
|
1542
|
-
##### Sample code
|
|
1543
|
-
```js
|
|
1544
|
-
this.cidaas.authenticateBackupcode({
|
|
1545
|
-
verifierPassword: 'your generated otp', // received via voice call
|
|
1546
|
-
code: 'your generated otp', // received via voice call
|
|
1547
|
-
statusId: 'your status id', // received from initiate call
|
|
1548
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1549
|
-
deviceInfo: {
|
|
1550
|
-
deviceId: 'your device id'
|
|
1551
|
-
}
|
|
1552
|
-
}).then((response) => {
|
|
1553
|
-
// the response will give you backup-code authentication details.
|
|
1554
|
-
}).catch((err) => {
|
|
1555
|
-
// your failure code here
|
|
1556
|
-
});
|
|
1557
|
-
```
|
|
1558
|
-
|
|
1559
|
-
##### Response
|
|
1560
|
-
```json
|
|
1561
|
-
{
|
|
1562
|
-
"success":true,
|
|
1563
|
-
"status":200,
|
|
1564
|
-
"data": {
|
|
1565
|
-
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1566
|
-
}
|
|
1567
|
-
}
|
|
1568
|
-
```
|
|
1569
|
-
|
|
1570
|
-
#### TOTP
|
|
1571
|
-
|
|
1572
|
-
##### Setup TOTP
|
|
1573
|
-
|
|
1574
|
-
To configure TOTP, call ****setupTOTP()****.
|
|
1575
|
-
|
|
1576
|
-
##### Sample code
|
|
1577
|
-
```js
|
|
1578
|
-
this.cidaas.setupTOTP({
|
|
1579
|
-
logoUrl: 'your logo url',
|
|
1580
|
-
deviceInfo: {
|
|
1581
|
-
deviceId: 'your device id'
|
|
1582
|
-
}
|
|
1583
|
-
}).then((response) => {
|
|
1584
|
-
// the response will give you details for TOTP setup.
|
|
1585
|
-
}).catch((err) => {
|
|
1586
|
-
// your failure code here
|
|
1587
|
-
});
|
|
1588
|
-
```
|
|
1589
|
-
|
|
1590
|
-
##### Response
|
|
1591
|
-
```json
|
|
1592
|
-
{
|
|
1593
|
-
"success":true,
|
|
1594
|
-
"status":200,
|
|
1595
|
-
"data": {
|
|
1596
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
```
|
|
1600
|
-
|
|
1601
|
-
##### Enroll TOTP
|
|
1602
|
-
|
|
1603
|
-
To enroll TOTP, call ****enrollTOTP()****.
|
|
1604
|
-
|
|
1605
|
-
##### Sample code
|
|
1606
|
-
```js
|
|
1607
|
-
this.cidaas.enrollTOTP({
|
|
1608
|
-
statusId: 'your status id', // which you received in setup totp response
|
|
1609
|
-
code: '1221234234', // which you seen in any of the authenticator apps you configured
|
|
1610
|
-
deviceInfo: {
|
|
1611
|
-
deviceId: 'your device id'
|
|
1612
|
-
}
|
|
1613
|
-
}).then((response) => {
|
|
1614
|
-
// the response will give you TOTP and device info to be linked.
|
|
1615
|
-
}).catch((err) => {
|
|
1616
|
-
// your failure code here
|
|
1617
|
-
});
|
|
1618
|
-
```
|
|
1619
|
-
|
|
1620
|
-
##### Response
|
|
1621
|
-
```json
|
|
1622
|
-
{
|
|
1623
|
-
"success":true,
|
|
1624
|
-
"status":200,
|
|
1625
|
-
"data": {
|
|
1626
|
-
"sub":"5f5cbb84-4ceb-4975-b347-4bfac61e9248",
|
|
1627
|
-
"trackingCode": "75hafysd7-5f5cbb84-4ceb-4975-b347-4bfac61e92"
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
```
|
|
1631
|
-
|
|
1632
|
-
##### Initiate TOTP
|
|
1633
|
-
|
|
1634
|
-
To initiate a TOTP verification type, call ****initiateTOTP()****.
|
|
1635
|
-
|
|
1636
|
-
##### Sample code
|
|
1637
|
-
```js
|
|
1638
|
-
this.cidaas.initiateTOTP({
|
|
1639
|
-
sub: 'your sub',
|
|
1640
|
-
physicalVerificationId: 'your physical verification id',
|
|
1641
|
-
userDeviceId: deviceId,
|
|
1642
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1643
|
-
deviceInfo: {
|
|
1644
|
-
deviceId: 'your device id'
|
|
1645
|
-
}
|
|
1646
|
-
}).then((response) => {
|
|
1647
|
-
// the response will give you TOTP verification details.
|
|
1648
|
-
}).catch((err) => {
|
|
1649
|
-
// your failure code here
|
|
1650
|
-
});
|
|
1651
|
-
```
|
|
1652
|
-
|
|
1653
|
-
##### Response
|
|
1654
|
-
```json
|
|
1655
|
-
{
|
|
1656
|
-
"success":true,
|
|
1657
|
-
"status":200,
|
|
1658
|
-
"data": {
|
|
1659
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1660
|
-
}
|
|
1661
|
-
}
|
|
1662
|
-
```
|
|
1663
|
-
|
|
1664
|
-
##### Authenticate TOTP
|
|
1665
|
-
|
|
1666
|
-
To verify the code, call ****authenticateTOTP()****.
|
|
1667
|
-
|
|
1668
|
-
##### Sample code
|
|
1669
|
-
```js
|
|
1670
|
-
this.cidaas.authenticateTOTP({
|
|
1671
|
-
verifierPassword: 'your generated otp', // received via voice call
|
|
1672
|
-
code: 'your generated otp', // received via voice call
|
|
1673
|
-
statusId: 'your status id', // received from initiate call
|
|
1674
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1675
|
-
deviceInfo: {
|
|
1676
|
-
deviceId: 'your device id'
|
|
1677
|
-
}
|
|
1678
|
-
}).then((response) => {
|
|
1679
|
-
// the response will give you TOTP authentication details.
|
|
1680
|
-
}).catch((err) => {
|
|
1681
|
-
// your failure code here
|
|
1682
|
-
});
|
|
1683
|
-
```
|
|
1684
|
-
|
|
1685
|
-
##### Response
|
|
1686
|
-
```json
|
|
1687
|
-
{
|
|
1688
|
-
"success":true,
|
|
1689
|
-
"status":200,
|
|
1690
|
-
"data": {
|
|
1691
|
-
"sub":"6f7e672c-1e69-4108-92c4-3556f13eda74","trackingCode":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1692
|
-
}
|
|
1693
|
-
}
|
|
1694
|
-
```
|
|
1695
|
-
|
|
1696
|
-
#### PATTERN
|
|
1697
|
-
|
|
1698
|
-
##### Setup Patttern
|
|
1699
|
-
|
|
1700
|
-
To configure Pattern, call ****setupPattern()****.
|
|
1701
|
-
|
|
1702
|
-
##### Sample code
|
|
1703
|
-
```js
|
|
1704
|
-
this.cidaas.setupPattern({
|
|
1705
|
-
logoUrl: 'your logo url',
|
|
1706
|
-
deviceInfo: {
|
|
1707
|
-
deviceId: 'your device id'
|
|
1708
|
-
}
|
|
1709
|
-
}).then((response) => {
|
|
1710
|
-
// the response will give you details for Pattern setup.
|
|
1711
|
-
}).catch((err) => {
|
|
1712
|
-
// your failure code here
|
|
1713
|
-
});
|
|
1714
|
-
```
|
|
1715
|
-
|
|
1716
|
-
##### Response
|
|
1717
|
-
```json
|
|
1718
|
-
{
|
|
1719
|
-
"success":true,
|
|
1720
|
-
"status":200,
|
|
1721
|
-
"data": {
|
|
1722
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1723
|
-
}
|
|
1724
|
-
}
|
|
1725
|
-
```
|
|
1726
|
-
|
|
1727
|
-
Once response is received, listen to the socket
|
|
1728
|
-
|
|
1729
|
-
##### Initiate PATTERN
|
|
1730
|
-
|
|
1731
|
-
To initiate a PATTERN verification type, call ****initiatePattern()****.
|
|
1732
|
-
|
|
1733
|
-
##### Sample code
|
|
1734
|
-
```js
|
|
1735
|
-
this.cidaas.initiatePattern({
|
|
1736
|
-
sub: 'your sub',
|
|
1737
|
-
physicalVerificationId: 'your physical verification id',
|
|
1738
|
-
userDeviceId: deviceId,
|
|
1739
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1740
|
-
deviceInfo: {
|
|
1741
|
-
deviceId: 'your device id'
|
|
1742
|
-
}
|
|
1743
|
-
}).then((response) => {
|
|
1744
|
-
// the response will give you Pattern verification details.
|
|
1745
|
-
}).catch((err) => {
|
|
1746
|
-
// your failure code here
|
|
1747
|
-
});
|
|
1748
|
-
```
|
|
1749
|
-
|
|
1750
|
-
##### Response
|
|
1751
|
-
```json
|
|
1752
|
-
{
|
|
1753
|
-
"success":true,
|
|
1754
|
-
"status":200,
|
|
1755
|
-
"data": {
|
|
1756
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1757
|
-
}
|
|
1758
|
-
}
|
|
1759
|
-
```
|
|
1760
|
-
|
|
1761
|
-
Once response is received, listen to the socket
|
|
1762
|
-
|
|
1763
|
-
#### TOUCHID
|
|
1764
|
-
|
|
1765
|
-
##### Setup TouchId
|
|
1766
|
-
|
|
1767
|
-
To configure TouchId, call ****setupTouchId()****.
|
|
1768
|
-
|
|
1769
|
-
##### Sample code
|
|
1770
|
-
```js
|
|
1771
|
-
this.cidaas.setupTouchId({
|
|
1772
|
-
logoUrl: 'your logo url',
|
|
1773
|
-
deviceInfo: {
|
|
1774
|
-
deviceId: 'your device id'
|
|
1775
|
-
}
|
|
1776
|
-
}).then((response) => {
|
|
1777
|
-
// the response will give you details for Touch ID setup.
|
|
1778
|
-
}).catch((err) => {
|
|
1779
|
-
// your failure code here
|
|
1780
|
-
});
|
|
1781
|
-
```
|
|
1782
|
-
|
|
1783
|
-
##### Response
|
|
1784
|
-
```json
|
|
1785
|
-
{
|
|
1786
|
-
"success":true,
|
|
1787
|
-
"status":200,
|
|
1788
|
-
"data": {
|
|
1789
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
```
|
|
1793
|
-
|
|
1794
|
-
Once response is received, listen to the socket
|
|
1795
|
-
|
|
1796
|
-
##### Initiate TOUCHID
|
|
1797
|
-
|
|
1798
|
-
To initiate a TOUCHID verification type, call ****initiateTouchId()****.
|
|
1799
|
-
|
|
1800
|
-
##### Sample code
|
|
1801
|
-
```js
|
|
1802
|
-
this.cidaas.initiateTouchId({
|
|
1803
|
-
sub: 'your sub',
|
|
1804
|
-
physicalVerificationId: 'your physical verification id',
|
|
1805
|
-
userDeviceId: deviceId,
|
|
1806
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1807
|
-
deviceInfo: {
|
|
1808
|
-
deviceId: 'your device id'
|
|
1809
|
-
}
|
|
1810
|
-
}).then((response) => {
|
|
1811
|
-
// the response will give you Touch ID verification details.
|
|
1812
|
-
}).catch((err) => {
|
|
1813
|
-
// your failure code here
|
|
1814
|
-
});
|
|
1815
|
-
```
|
|
1816
|
-
|
|
1817
|
-
Once response is received, listen to the socket
|
|
1818
|
-
|
|
1819
|
-
##### Response
|
|
1820
|
-
```json
|
|
1821
|
-
{
|
|
1822
|
-
"success":true,
|
|
1823
|
-
"status":200,
|
|
1824
|
-
"data": {
|
|
1825
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
```
|
|
1829
|
-
|
|
1830
|
-
#### SMART PUSH
|
|
1831
|
-
|
|
1832
|
-
##### Setup Smart Push
|
|
1833
|
-
|
|
1834
|
-
To configure SmartPush, call ****setupSmartPush()****.
|
|
1835
|
-
|
|
1836
|
-
##### Sample code
|
|
1837
|
-
```js
|
|
1838
|
-
this.cidaas.setupSmartPush({
|
|
1839
|
-
logoUrl: 'your logo url',
|
|
1840
|
-
deviceInfo: {
|
|
1841
|
-
deviceId: 'your device id'
|
|
1842
|
-
}
|
|
1843
|
-
}).then((response) => {
|
|
1844
|
-
// the response will give you details for Smart Push setup.
|
|
1845
|
-
}).catch((err) => {
|
|
1846
|
-
// your failure code here
|
|
1847
|
-
});
|
|
1848
|
-
```
|
|
1849
|
-
|
|
1850
|
-
Once response is received, listen to the socket
|
|
1851
|
-
|
|
1852
|
-
##### Initiate SMART PUSH
|
|
1853
|
-
|
|
1854
|
-
To initiate a SMART PUSH verification type, call ****initiateSmartPush()****.
|
|
1855
|
-
|
|
1856
|
-
##### Sample code
|
|
1857
|
-
```js
|
|
1858
|
-
this.cidaas.initiateSmartPush({
|
|
1859
|
-
sub: 'your sub',
|
|
1860
|
-
physicalVerificationId: 'your physical verification id',
|
|
1861
|
-
userDeviceId: deviceId,
|
|
1862
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1863
|
-
deviceInfo: {
|
|
1864
|
-
deviceId: 'your device id'
|
|
1865
|
-
}
|
|
1866
|
-
}).then((response) => {
|
|
1867
|
-
// the response will give you Smart Push verification details.
|
|
1868
|
-
}).catch((err) => {
|
|
1869
|
-
// your failure code here
|
|
1870
|
-
});
|
|
1871
|
-
```
|
|
1872
|
-
|
|
1873
|
-
Once response is received, listen to the socket
|
|
1874
|
-
|
|
1875
|
-
##### Response
|
|
1876
|
-
```json
|
|
1877
|
-
{
|
|
1878
|
-
"success":true,
|
|
1879
|
-
"status":200,
|
|
1880
|
-
"data": {
|
|
1881
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
```
|
|
1885
|
-
|
|
1886
|
-
#### FACE
|
|
1887
|
-
|
|
1888
|
-
##### Setup Face
|
|
1889
|
-
|
|
1890
|
-
To configure Face, call ****setupFace()****.
|
|
1891
|
-
|
|
1892
|
-
##### Sample code
|
|
1893
|
-
```js
|
|
1894
|
-
this.cidaas.setupFace({
|
|
1895
|
-
logoUrl: 'your logo url',
|
|
1896
|
-
deviceInfo: {
|
|
1897
|
-
deviceId: 'your device id'
|
|
1898
|
-
}
|
|
1899
|
-
}).then((response) => {
|
|
1900
|
-
// the response will give you details for Face setup.
|
|
1901
|
-
}).catch((err) => {
|
|
1902
|
-
// your failure code here
|
|
1903
|
-
});
|
|
1904
|
-
```
|
|
1905
|
-
|
|
1906
|
-
##### Response
|
|
1907
|
-
```json
|
|
1908
|
-
{
|
|
1909
|
-
"success":true,
|
|
1910
|
-
"status":200,
|
|
1911
|
-
"data": {
|
|
1912
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
```
|
|
1916
|
-
|
|
1917
|
-
Once response is received, listen to the socket
|
|
1918
|
-
|
|
1919
|
-
##### Initiate FACE
|
|
1920
|
-
|
|
1921
|
-
To initiate a FACE verification type, call ****initiateFace()****.
|
|
1922
|
-
|
|
1923
|
-
##### Sample code
|
|
1924
|
-
```js
|
|
1925
|
-
this.cidaas.initiateFace({
|
|
1926
|
-
sub: 'your sub',
|
|
1927
|
-
physicalVerificationId: 'your physical verification id',
|
|
1928
|
-
userDeviceId: deviceId,
|
|
1929
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1930
|
-
deviceInfo: {
|
|
1931
|
-
deviceId: 'your device id'
|
|
1932
|
-
}
|
|
1933
|
-
}).then((response) => {
|
|
1934
|
-
// the response will give you Face verification details.
|
|
1935
|
-
}).catch((err) => {
|
|
1936
|
-
// your failure code here
|
|
1937
|
-
});
|
|
1938
|
-
```
|
|
1939
|
-
|
|
1940
|
-
Once response is received, listen to the socket
|
|
1941
|
-
|
|
1942
|
-
##### Response
|
|
1943
|
-
```json
|
|
1944
|
-
{
|
|
1945
|
-
"success":true,
|
|
1946
|
-
"status":200,
|
|
1947
|
-
"data": {
|
|
1948
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1949
|
-
}
|
|
1950
|
-
}
|
|
1951
|
-
```
|
|
1952
|
-
|
|
1953
|
-
#### VOICE
|
|
1954
|
-
|
|
1955
|
-
##### Setup Voice
|
|
1956
|
-
|
|
1957
|
-
To configure Voice, call ****setupVoice()****.
|
|
1958
|
-
|
|
1959
|
-
##### Sample code
|
|
1960
|
-
```js
|
|
1961
|
-
this.cidaas.setupVoice({
|
|
1962
|
-
logoUrl: 'your logo url',
|
|
1963
|
-
deviceInfo: {
|
|
1964
|
-
deviceId: 'your device id'
|
|
1965
|
-
}
|
|
1966
|
-
}).then((response) => {
|
|
1967
|
-
// the response will give you details for Voice setup.
|
|
1968
|
-
}).catch((err) => {
|
|
1969
|
-
// your failure code here
|
|
1970
|
-
});
|
|
1971
|
-
```
|
|
1972
|
-
|
|
1973
|
-
##### Response
|
|
1974
|
-
```json
|
|
1975
|
-
{
|
|
1976
|
-
"success":true,
|
|
1977
|
-
"status":200,
|
|
1978
|
-
"data": {
|
|
1979
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
1980
|
-
}
|
|
1981
|
-
}
|
|
1982
|
-
```
|
|
1983
|
-
|
|
1984
|
-
Once response is received, listen to the socket
|
|
1985
|
-
|
|
1986
|
-
##### Initiate VOICE
|
|
1987
|
-
|
|
1988
|
-
To initiate a VOICE verification type, call ****initiateVoice()****.
|
|
1989
|
-
|
|
1990
|
-
##### Sample code
|
|
1991
|
-
```js
|
|
1992
|
-
this.cidaas.initiateVoice({
|
|
1993
|
-
sub: 'your sub',
|
|
1994
|
-
physicalVerificationId: 'your physical verification id',
|
|
1995
|
-
userDeviceId: deviceId,
|
|
1996
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
1997
|
-
deviceInfo: {
|
|
1998
|
-
deviceId: 'your device id'
|
|
1999
|
-
}
|
|
2000
|
-
}).then((response) => {
|
|
2001
|
-
// the response will give you Voice verification details.
|
|
2002
|
-
}).catch((err) => {
|
|
2003
|
-
// your failure code here
|
|
2004
|
-
});
|
|
2005
|
-
```
|
|
2006
|
-
|
|
2007
|
-
##### Response
|
|
2008
|
-
```json
|
|
2009
|
-
{
|
|
2010
|
-
"success":true,
|
|
2011
|
-
"status":200,
|
|
2012
|
-
"data": {
|
|
2013
|
-
"statusId":"5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
2014
|
-
}
|
|
2015
|
-
}
|
|
2016
|
-
```
|
|
2017
|
-
|
|
2018
|
-
Once response is received, listen to the socket
|
|
2019
|
-
|
|
2020
|
-
#### MFA Continue
|
|
2021
|
-
|
|
2022
|
-
To continue after MFA completion, call ****mfaContinue()****.
|
|
2023
|
-
|
|
2024
|
-
##### Sample code
|
|
2025
|
-
```js
|
|
2026
|
-
this.cidaas.mfaContinue({
|
|
2027
|
-
trackingCode: 'your tracking Code', // receives in socket
|
|
2028
|
-
track_id: 'your track id',
|
|
2029
|
-
sub: 'your sub',
|
|
2030
|
-
requestId: 'your request id'
|
|
2031
|
-
});
|
|
2032
|
-
```
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
##### Get All Verification List
|
|
2036
|
-
List all verification type configured, call **getAllVerificationList()**. access_token must be passed as function paramere.
|
|
2037
|
-
|
|
2038
|
-
##### Sample code
|
|
2039
|
-
```js
|
|
2040
|
-
const access_token = "eyJhbGciOiJSUzI1NiIsImtpZCI6IjEwMjM2ZWZiLWRlMjEtNDI5Mi04Z.";
|
|
2041
|
-
|
|
2042
|
-
cidaas.getAllVerificationList(access_token)
|
|
2043
|
-
.then(function (response) {
|
|
2044
|
-
// type your code here
|
|
2045
|
-
})
|
|
2046
|
-
.catch(function (ex) {
|
|
2047
|
-
// your failure code here
|
|
2048
|
-
});
|
|
2049
|
-
```
|
|
2050
|
-
|
|
2051
|
-
#### Consent Management
|
|
2052
|
-
|
|
2053
|
-
For the first time login, the user needs to accept the terms and conditions.
|
|
2054
|
-
|
|
2055
|
-
##### Get consent details
|
|
2056
|
-
|
|
2057
|
-
To get the details of consent tile and description, call ****getConsentDetails()****
|
|
2058
|
-
|
|
2059
|
-
##### Sample code
|
|
2060
|
-
```js
|
|
2061
|
-
this.cidaas.getConsentDetails({
|
|
2062
|
-
consent_name: 'your consent name',
|
|
2063
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
2064
|
-
}).then((response) => {
|
|
2065
|
-
// the response will give you details of consent.
|
|
2066
|
-
}).catch((err) => {
|
|
2067
|
-
// your failure code here
|
|
2068
|
-
});
|
|
2069
|
-
```
|
|
2070
|
-
|
|
2071
|
-
##### Response
|
|
2072
|
-
```json
|
|
2073
|
-
{
|
|
2074
|
-
"success":true,
|
|
2075
|
-
"status":200,
|
|
2076
|
-
"data": {
|
|
2077
|
-
"title" : 'consent title',
|
|
2078
|
-
"description" : 'consent description',
|
|
2079
|
-
"userAgreeText" : 'I agree'
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
```
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
##### Get Consent Details V2
|
|
2086
|
-
To get consent details , call **getConsentDetailsV2()**. The function accepts a parameter of type object. The options paramter in the sample must contain the keys mentioned in in the api document https://docs.cidaas.com/docs/cidaas-iam/858fbeb51c62b-find-consent-info
|
|
2087
|
-
|
|
2088
|
-
##### Sample code
|
|
2089
|
-
|
|
2090
|
-
```js
|
|
2091
|
-
cidaas.getConsentDetailsV2(options)
|
|
2092
|
-
.then(function (response) {
|
|
2093
|
-
// type your code here
|
|
2094
|
-
})
|
|
2095
|
-
.catch(function (ex) {
|
|
2096
|
-
// your failure code here
|
|
2097
|
-
});
|
|
2098
|
-
```
|
|
2099
|
-
|
|
2100
|
-
##### Accept consent
|
|
2101
|
-
|
|
2102
|
-
To accept consent, call ****acceptConsent()****
|
|
2103
|
-
|
|
2104
|
-
##### Sample code
|
|
2105
|
-
```js
|
|
2106
|
-
this.cidaas.acceptConsent({
|
|
2107
|
-
name: 'your consent name',
|
|
2108
|
-
sub: 'your sub',
|
|
2109
|
-
client_id: 'your client id',
|
|
2110
|
-
accepted: true
|
|
2111
|
-
}).then((response) => {
|
|
2112
|
-
// the response will give you details of accepted consent.
|
|
2113
|
-
}).catch((err) => {
|
|
2114
|
-
// your failure code here
|
|
2115
|
-
});
|
|
2116
|
-
```
|
|
2117
|
-
|
|
2118
|
-
##### Response
|
|
2119
|
-
```json
|
|
2120
|
-
{
|
|
2121
|
-
"success":true,
|
|
2122
|
-
"status":200,
|
|
2123
|
-
"data": {
|
|
2124
|
-
"accepted": true
|
|
2125
|
-
}
|
|
2126
|
-
}
|
|
2127
|
-
```
|
|
2128
|
-
|
|
2129
|
-
##### Accept Consent V2
|
|
2130
|
-
To accept consent, call **acceptConsentV2()**. The function accepts a parameter of type object. The options paramter in the sample must contain the keys mentioned in in the api document https://docs.cidaas.com/docs/cidaas-iam/0caa9bacdd29e-accept-consent
|
|
2131
|
-
|
|
2132
|
-
##### Sample code
|
|
2133
|
-
|
|
2134
|
-
```js
|
|
2135
|
-
cidaas.acceptConsentV2(options)
|
|
2136
|
-
.then(function (response) {
|
|
2137
|
-
// type your code here
|
|
2138
|
-
})
|
|
2139
|
-
.catch(function (ex) {
|
|
2140
|
-
// your failure code here
|
|
2141
|
-
});
|
|
2142
|
-
```
|
|
2143
|
-
|
|
2144
|
-
##### Consent Continue
|
|
2145
|
-
|
|
2146
|
-
To continue after Consent acceptance, call ****consentContinue()****.
|
|
2147
|
-
|
|
2148
|
-
##### Sample code
|
|
2149
|
-
```js
|
|
2150
|
-
this.cidaas.consentContinue({
|
|
2151
|
-
name: 'your consent name',
|
|
2152
|
-
version: 'your consent version',
|
|
2153
|
-
client_id: 'your client id',
|
|
2154
|
-
track_id: 'your track id',
|
|
2155
|
-
sub: 'your sub',
|
|
2156
|
-
});
|
|
2157
|
-
```
|
|
2158
|
-
##### Accept claim
|
|
2159
|
-
|
|
2160
|
-
To accept Claim Consent, call ****acceptClaimConsent()****
|
|
2161
|
-
|
|
2162
|
-
##### Sample code
|
|
2163
|
-
```js
|
|
2164
|
-
this.cidaas.acceptClaimConsent({
|
|
2165
|
-
q: 'your sub',
|
|
2166
|
-
client_id: 'your client id',
|
|
2167
|
-
accepted: "accepted claims with array eg: []"
|
|
2168
|
-
}).then((response) => {
|
|
2169
|
-
// the response will give you accepted claim consent.
|
|
2170
|
-
}).catch((err) => {
|
|
2171
|
-
// your failure code here
|
|
2172
|
-
});
|
|
2173
|
-
```
|
|
2174
|
-
|
|
2175
|
-
##### Response
|
|
2176
|
-
```json
|
|
2177
|
-
{
|
|
2178
|
-
"success":true,
|
|
2179
|
-
"status":200,
|
|
2180
|
-
"data": true
|
|
2181
|
-
}
|
|
2182
|
-
```
|
|
2183
|
-
|
|
2184
|
-
##### Revoke claim
|
|
2185
|
-
|
|
2186
|
-
To revoke Claim Consent, call ****revokeClaimConsent()****
|
|
2187
|
-
|
|
2188
|
-
##### Sample code
|
|
2189
|
-
```js
|
|
2190
|
-
this.cidaas.revokeClaimConsent({
|
|
2191
|
-
sub: 'your sub',
|
|
2192
|
-
revoked_claims: "revoked claims with array eg: []"
|
|
2193
|
-
}).then((response) => {
|
|
2194
|
-
// the response will give you revoked claim consent.
|
|
2195
|
-
}).catch((err) => {
|
|
2196
|
-
// your failure code here
|
|
2197
|
-
});
|
|
2198
|
-
```
|
|
2199
|
-
|
|
2200
|
-
##### Response
|
|
2201
|
-
```json
|
|
2202
|
-
{
|
|
2203
|
-
"success":true,
|
|
2204
|
-
"status":200,
|
|
2205
|
-
"data": true
|
|
2206
|
-
}
|
|
2207
|
-
```
|
|
2208
|
-
|
|
2209
|
-
##### Get Scope Consent Details
|
|
2210
|
-
To get scope consent details, call **getScopeConsentDetails()**. The function accepts a parameter of type object. The options paramter in the sample must contain the keys mentioned in the below table.The function calls the api available in the document https://docs.cidaas.com/docs/cidaas-iam/f4b1bee4c3313-pre-login-check. Please refer to the api document for more details
|
|
2211
|
-
|
|
2212
|
-
| Key name | Type | Description | Is optional |
|
|
2213
|
-
| ---- | ---- | ----------- | ----------- |
|
|
2214
|
-
| track_id | string | the track id recieved while logging in | false |
|
|
2215
|
-
| locale | string | browser accept language or custom language | false |
|
|
2216
|
-
|
|
2217
|
-
##### Sample code
|
|
2218
|
-
|
|
2219
|
-
```js
|
|
2220
|
-
let options = {
|
|
2221
|
-
track_id: "5f5cbb84-4ceb-4975-b347-4bfac61e9248",
|
|
2222
|
-
locale: "en-US"
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
cidaas.getScopeConsentDetails(options)
|
|
2226
|
-
.then(function (response) {
|
|
2227
|
-
// type your code here
|
|
2228
|
-
})
|
|
2229
|
-
.catch(function (ex) {
|
|
2230
|
-
// your failure code here
|
|
2231
|
-
});
|
|
2232
|
-
```
|
|
2233
|
-
|
|
2234
|
-
##### Get Scope Consent Version Details V2
|
|
2235
|
-
To get scope consent version detials V2, call **getScopeConsentVersionDetailsV2()**. The function accepts a parameter of type object. The options paramter in the sample must contain the keys mentioned in the below table.The function calls the api available in the document https://docs.cidaas.com/docs/cidaas-iam/7e24ac2113315-get-consent-version-details. Please refer to the api document for more details.
|
|
2236
|
-
|
|
2237
|
-
| Key name | Type | Description | Is optional |
|
|
2238
|
-
| ---- | ---- | ----------- | ----------- |
|
|
2239
|
-
| scopeid | string | the consent id(please refer to api document mentioned above) | false |
|
|
2240
|
-
| locale | string | browser accept language or custom language | false |
|
|
2241
|
-
|
|
2242
|
-
##### Sample code
|
|
2243
|
-
|
|
2244
|
-
```js
|
|
2245
|
-
let options = {
|
|
2246
|
-
scopeid: "5f5cbb84-4ceb-4975-b347-4bfac61e9248",
|
|
2247
|
-
locale: "en-US"
|
|
2248
|
-
}
|
|
2249
|
-
|
|
2250
|
-
cidaas.getScopeConsentVersionDestailsV(options)
|
|
2251
|
-
.then(function (response) {
|
|
2252
|
-
// type your code here
|
|
2253
|
-
})
|
|
2254
|
-
.catch(function (ex) {
|
|
2255
|
-
// your failure code here
|
|
2256
|
-
});
|
|
2257
|
-
```
|
|
2258
|
-
|
|
2259
|
-
##### Accept Scope Consent
|
|
2260
|
-
To accept scope consent, call **acceptScopeConsent()**. The options paramter in the sample must contain the keys mentioned in in the api document https://docs.cidaas.com/docs/cidaas-iam/84c69a098c5c7-accept-scope-consent. Please refer to the api document for more details.
|
|
2261
|
-
|
|
2262
|
-
##### Sample code
|
|
2263
|
-
|
|
2264
|
-
```js
|
|
2265
|
-
cidaas
|
|
2266
|
-
.acceptScopeConsent(options)
|
|
2267
|
-
.then(function (response) {
|
|
2268
|
-
// type your code here
|
|
2269
|
-
})
|
|
2270
|
-
.catch(function (ex) {
|
|
2271
|
-
// your failure code here
|
|
2272
|
-
});
|
|
2273
|
-
```
|
|
2274
|
-
|
|
2275
|
-
##### Scope Consent Continue Login
|
|
2276
|
-
To scope consent continue login, call **scopeConsentContinue()**. The function accepts a parameter of type object. The options paramter in the sample must contain the keys mentioned in the below table.The function calls the api available in the document https://docs.cidaas.com/docs/cidaas-iam/aa32097970c52-continue-authentication-flow-after-prechecks. Please refer to the api document for more details.
|
|
2277
|
-
|
|
2278
|
-
| Key name | Type | Description | Is optional |
|
|
2279
|
-
| ---- | ---- | ----------- | ----------- |
|
|
2280
|
-
| track_id | string | track id recieved while loggine in| false |
|
|
2281
|
-
|
|
2282
|
-
##### Sample code
|
|
2283
|
-
|
|
2284
|
-
```js
|
|
2285
|
-
let options = {
|
|
2286
|
-
track_id: "5f5cbb84-4ceb-4975-b347-4bfac61e9248"
|
|
2287
|
-
}
|
|
2288
|
-
cidaas.scopeConsentContinue(options)
|
|
2289
|
-
.then(function (response) {
|
|
2290
|
-
// type your code here
|
|
2291
|
-
})
|
|
2292
|
-
.catch(function (ex) {
|
|
2293
|
-
// your failure code here
|
|
2294
|
-
});
|
|
2295
|
-
```
|
|
2296
|
-
|
|
2297
|
-
#### Deduplication
|
|
2298
|
-
|
|
2299
|
-
##### Get deduplication details
|
|
2300
|
-
|
|
2301
|
-
To get the list of existing users in deduplication, call ****getDeduplicationDetails()****.
|
|
2302
|
-
|
|
2303
|
-
##### Sample code
|
|
2304
|
-
```js
|
|
2305
|
-
this.cidaas.getDeduplicationDetails({
|
|
2306
|
-
track_id: 'your track id',
|
|
2307
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
2308
|
-
}).then((response) => {
|
|
2309
|
-
// the response will give you deduplication details of users.
|
|
2310
|
-
}).catch((err) => {
|
|
2311
|
-
// your failure code here
|
|
2312
|
-
});
|
|
2313
|
-
```
|
|
2314
|
-
|
|
2315
|
-
##### Response
|
|
2316
|
-
```json
|
|
2317
|
-
{
|
|
2318
|
-
"success":true,
|
|
2319
|
-
"status":200,
|
|
2320
|
-
"data": [
|
|
2321
|
-
{
|
|
2322
|
-
"provider": 'SELF',
|
|
2323
|
-
"sub": 'etsdf34545sdfsdf',
|
|
2324
|
-
"email": 'davidjhonson@gmail.com',
|
|
2325
|
-
"emailName": 'davidjhonson@gmail.com',
|
|
2326
|
-
"firstname": 'David',
|
|
2327
|
-
"lastname": 'Jhonson',
|
|
2328
|
-
"displayName": 'David Jhonson',
|
|
2329
|
-
}
|
|
2330
|
-
]
|
|
2331
|
-
}
|
|
2332
|
-
```
|
|
2333
|
-
|
|
2334
|
-
##### Register deduplication
|
|
2335
|
-
|
|
2336
|
-
To register new user in deduplication, call ****registerDeduplication()****.
|
|
2337
|
-
|
|
2338
|
-
##### Sample code
|
|
2339
|
-
```js
|
|
2340
|
-
this.cidaas.registerDeduplication({
|
|
2341
|
-
track_id: 'your track id',
|
|
2342
|
-
acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
2343
|
-
}).then((response) => {
|
|
2344
|
-
// the response will give you new registered deduplication user.
|
|
2345
|
-
}).catch((err) => {
|
|
2346
|
-
// your failure code here
|
|
2347
|
-
});
|
|
2348
|
-
```
|
|
2349
|
-
|
|
2350
|
-
##### Response
|
|
2351
|
-
```json
|
|
2352
|
-
{
|
|
2353
|
-
"success": true,
|
|
2354
|
-
"status": 200,
|
|
2355
|
-
"data": {
|
|
2356
|
-
"sub": "7dfb2122-fa5e-4f7a-8494-dadac9b43f9d",
|
|
2357
|
-
"userStatus": "VERIFIED",
|
|
2358
|
-
"email_verified": false,
|
|
2359
|
-
"suggested_action": "LOGIN"
|
|
2360
|
-
}
|
|
2361
|
-
}
|
|
2362
|
-
```
|
|
2363
|
-
|
|
2364
|
-
##### Deduplication login
|
|
2365
|
-
|
|
2366
|
-
To use the existing users in deduplication, you need to enter password for the users and call ****deduplicationLogin()****.
|
|
2367
|
-
|
|
2368
|
-
##### Sample code
|
|
2369
|
-
```js
|
|
2370
|
-
this.cidaas.deduplicationLogin({
|
|
2371
|
-
sub: 'your sub',
|
|
2372
|
-
requestId: 'your request id',
|
|
2373
|
-
password: 'your password'
|
|
2374
|
-
}).then((response) => {
|
|
2375
|
-
// the response will give you deduplication login details.
|
|
2376
|
-
}).catch((err) => {
|
|
2377
|
-
// your failure code here
|
|
2378
|
-
});
|
|
2379
|
-
```
|
|
2380
|
-
|
|
2381
|
-
##### Response
|
|
2382
|
-
```json
|
|
2383
|
-
{
|
|
2384
|
-
"success":true,
|
|
2385
|
-
"status":200,
|
|
2386
|
-
"data": {
|
|
2387
|
-
"token_type":"Bearer",
|
|
2388
|
-
"expires_in":86400,
|
|
2389
|
-
"access_token":"eyJhbGciOiJSUzI1NiIsImtpZCI6IjEwMjM2ZWZiLWRlMjEtNDI5Mi04Z.",
|
|
2390
|
-
"session_state":"3F7CuT3jnKOTwRyyLBWaRizLiPm5mJ4PnhY.jfQO3MeEAuM",
|
|
2391
|
-
"viewtype":"login",
|
|
2392
|
-
"grant_type":"login"
|
|
2393
|
-
}
|
|
2394
|
-
}
|
|
2395
|
-
```
|
|
2396
|
-
|
|
2397
|
-
##### Initiate Users Link
|
|
2398
|
-
|
|
2399
|
-
To initiate a new user link, call ****userAccountLink()****.
|
|
2400
|
-
|
|
2401
|
-
##### Sample code
|
|
2402
|
-
|
|
2403
|
-
```js
|
|
2404
|
-
var options = {
|
|
2405
|
-
sub: 'sub of the user who initiates the user link',
|
|
2406
|
-
username: 'username of the user which should get linked',
|
|
2407
|
-
redirect_uri: 'redirect uri the user should get redirected after successful account linking'
|
|
2408
|
-
}
|
|
2409
|
-
```
|
|
2410
|
-
|
|
2411
|
-
```js
|
|
2412
|
-
this.cidaas.userAccountLink(options, access_token).then((response) => {
|
|
2413
|
-
// the response will give you that both user are linked.
|
|
2414
|
-
}).catch((err) => {
|
|
2415
|
-
// your failure code here
|
|
2416
|
-
});
|
|
2417
|
-
```
|
|
2418
|
-
|
|
2419
|
-
##### Response
|
|
2420
|
-
```json
|
|
2421
|
-
{
|
|
2422
|
-
"success":true,
|
|
2423
|
-
"status":200,
|
|
2424
|
-
"data": {
|
|
2425
|
-
"redirectUri": "string"
|
|
2426
|
-
}
|
|
2427
|
-
}
|
|
2428
|
-
```
|
|
2429
|
-
|
|
2430
|
-
#### Socket Connection
|
|
2431
|
-
|
|
2432
|
-
##### Installation
|
|
2433
|
-
|
|
2434
|
-
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
|
|
2435
|
-
|
|
2436
|
-
#### Configuration
|
|
2437
|
-
|
|
2438
|
-
##### Emitting the socket
|
|
2439
|
-
|
|
2440
|
-
```
|
|
2441
|
-
this.socket.emit("join", {
|
|
2442
|
-
id: 'your status id' // which you received in the response of setup call
|
|
2443
|
-
});
|
|
2444
|
-
```
|
|
2445
|
-
|
|
2446
|
-
##### Sample code
|
|
2447
|
-
|
|
2448
|
-
```
|
|
2449
|
-
this.cidaas.setupPattern({
|
|
2450
|
-
logoUrl: 'your logo url',
|
|
2451
|
-
deviceInfo: {
|
|
2452
|
-
deviceId: 'your device id'
|
|
2453
|
-
}
|
|
2454
|
-
}).then((response) => {
|
|
2455
|
-
this.socket.emit("join", {
|
|
2456
|
-
id: response.data.statusId
|
|
2457
|
-
});
|
|
2458
|
-
}).catch((err) => {
|
|
2459
|
-
// your failure code here
|
|
2460
|
-
});
|
|
2461
|
-
```
|
|
2462
|
-
|
|
2463
|
-
##### Listening the socket
|
|
2464
|
-
|
|
2465
|
-
You can listen the socket anywhere in your component
|
|
2466
|
-
|
|
2467
|
-
```
|
|
2468
|
-
this.socket.on("status-update", (msg) => {
|
|
2469
|
-
if (msg.status == "SCANNED") {
|
|
2470
|
-
// do next process
|
|
2471
|
-
}
|
|
2472
|
-
else if (msg.status == "ENROLLED") {
|
|
2473
|
-
// do next process
|
|
2474
|
-
}
|
|
2475
|
-
});
|
|
2476
|
-
```
|
|
2477
|
-
|
|
2478
|
-
#### Usage
|
|
2479
|
-
|
|
2480
|
-
##### Emitting the socket
|
|
2481
|
-
|
|
2482
|
-
```
|
|
2483
|
-
this.socket.emit("on-trigger-verification", {
|
|
2484
|
-
id: 'your status id' // which you received in the response of initiate call
|
|
2485
|
-
});
|
|
2486
|
-
```
|
|
2487
|
-
|
|
2488
|
-
##### Sample code
|
|
2489
|
-
|
|
2490
|
-
```
|
|
2491
|
-
this.cidaas.initiatePattern({
|
|
2492
|
-
sub: 'your sub',
|
|
2493
|
-
physicalVerificationId: 'your physical verification id',
|
|
2494
|
-
userDeviceId: deviceId,
|
|
2495
|
-
usageType: 'your usage type', // PASSWORDLESS_AUTHENTICATION or MULTI_FACTOR_AUTHENTICATION
|
|
2496
|
-
deviceInfo: {
|
|
2497
|
-
deviceId: 'your device id'
|
|
2498
|
-
}
|
|
2499
|
-
}).then((response) => {
|
|
2500
|
-
this.socket.emit("on-trigger-verification", {
|
|
2501
|
-
id: response.data.statusId
|
|
2502
|
-
});
|
|
2503
|
-
}).catch((err) => {
|
|
2504
|
-
// your failure code here
|
|
2505
|
-
});
|
|
2506
|
-
```
|
|
2507
|
-
|
|
2508
|
-
##### Listening the socket
|
|
2509
|
-
|
|
2510
|
-
You can listen the socket anywhere in your component.
|
|
2511
|
-
|
|
2512
|
-
```
|
|
2513
|
-
this.socket.on("status-update", (msg) => {
|
|
2514
|
-
if (msg.status == "AUTHENTICATED") {
|
|
2515
|
-
// do next process
|
|
2516
|
-
}
|
|
2517
|
-
});
|
|
2518
|
-
```
|
|
2519
|
-
#### Access Token
|
|
2520
|
-
|
|
2521
|
-
##### Get aceess token
|
|
2522
|
-
To get a new token with th grant type authorization_code, call **getAccessToken()**. The function accepts a function parameter of type object. The object with the keys described in the below table
|
|
2523
|
-
|
|
2524
|
-
| Key name | Type | Description | Is optional |
|
|
2525
|
-
| ---- | ---- | ----------- | ----------- |
|
|
2526
|
-
| code | string | code to create a new token | false |
|
|
2527
|
-
|
|
2528
|
-
##### Sample code
|
|
2529
|
-
|
|
2530
|
-
```js
|
|
2531
|
-
options = {
|
|
2532
|
-
code: "123456",
|
|
2533
|
-
}
|
|
2534
|
-
|
|
2535
|
-
cidaas.getAccessToken(options)
|
|
2536
|
-
.then(function (response) {
|
|
2537
|
-
// type your code here
|
|
2538
|
-
})
|
|
2539
|
-
.catch(function (ex) {
|
|
2540
|
-
// your failure code here
|
|
2541
|
-
});
|
|
2542
|
-
```
|
|
2543
|
-
|
|
2544
|
-
##### Validate access token
|
|
2545
|
-
To validate an access token, call **validateAccessToken()**. The function accepts a function parameter of type object. The object with the keys described in the below table.
|
|
2546
|
-
|
|
2547
|
-
| Key name | Type | Description | Is optional |
|
|
2548
|
-
| ---- | ---- | ----------- | ----------- |
|
|
2549
|
-
| token | string | access token | false |
|
|
2550
|
-
| token_type_hint | string | token type hint. accepted token type hints are access_token, id_token, refresh_token, sso | false |
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
##### Sample code
|
|
2554
|
-
|
|
2555
|
-
```js
|
|
2556
|
-
options = {
|
|
2557
|
-
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
|
|
2558
|
-
token_type_hint: "access_token",
|
|
2559
|
-
}
|
|
2560
|
-
|
|
2561
|
-
cidaas.validateAccessToken(options)
|
|
2562
|
-
.then(function (response) {
|
|
2563
|
-
// type your code here
|
|
2564
|
-
})
|
|
2565
|
-
.catch(function (ex) {
|
|
2566
|
-
// your failure code here
|
|
2567
|
-
});
|
|
2568
|
-
```
|
|
2569
|
-
|
|
2570
|
-
##### Renew token
|
|
2571
|
-
To get a new token with the grant type refresh_token, call **renewToken()**. The function accepts a function parameter of type object. The object with the keys described in the below table
|
|
2572
|
-
|
|
2573
|
-
| Key Name | Type | Description | Is optional |
|
|
2574
|
-
| ---- | ---- | ----------- | ----------- |
|
|
2575
|
-
| refresh_token | string | The refresh token to create a new token. The refresh token is received while creating an access token using the token endpoint and later can be used to fetch a new token without using credentials | false |
|
|
2576
|
-
|
|
2577
|
-
##### Sample code
|
|
2578
|
-
|
|
2579
|
-
```js
|
|
2580
|
-
options = {
|
|
2581
|
-
refresh_token: "bGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
|
|
2582
|
-
}
|
|
2583
|
-
|
|
2584
|
-
cidaas.renewToken(options)
|
|
2585
|
-
.then(function (response) {
|
|
2586
|
-
// type your code here
|
|
2587
|
-
})
|
|
2588
|
-
.catch(function (ex) {
|
|
2589
|
-
// your failure code here
|
|
2590
|
-
});
|
|
2591
|
-
```
|
|
2592
|
-
#### Device
|
|
2593
|
-
##### Get Device Info
|
|
2594
|
-
To get the device information, call **getDeviceInfo()**
|
|
2595
|
-
|
|
2596
|
-
##### Sample code
|
|
2597
|
-
|
|
2598
|
-
```js
|
|
2599
|
-
cidaas.getDeviceInfo()
|
|
2600
|
-
.then(function (response) {
|
|
2601
|
-
// type your code here
|
|
2602
|
-
})
|
|
2603
|
-
.catch(function (ex) {
|
|
2604
|
-
// your failure code here
|
|
2605
|
-
});
|
|
2606
|
-
```
|
|
187
|
+
| SDK Functions | Description |
|
|
188
|
+
|------------------------------------------------|---------------------------------------------------------------------------------------------|
|
|
189
|
+
| getRequestId | The SDK could be used to get request id, which is required as input to call other functions |
|
|
190
|
+
| getLoginURL | Getting login authz url is supported by the SDK |
|
|
191
|
+
| getTenantInfo, getClientInfo | Getting public information such as tenant info & client info is supported by the SDK |
|
|
192
|
+
| setAcceptLanguageHeader | The SDK could be used to change response language |
|
|
193
|
+
| createDeviceInfo, getDevicesInfo, deleteDevice | Creating, getting, and removing device information is supported by the SDK |
|
|
194
|
+
| logoutUser | The SDK could be used to end user session by using cidaas internal api |
|
|
2607
195
|
|
|
2608
196
|
## Possible Error
|
|
2609
197
|
|