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
|
@@ -38,12 +38,26 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
38
38
|
exports.__esModule = true;
|
|
39
39
|
exports.TokenService = void 0;
|
|
40
40
|
var Helper_1 = require("./Helper");
|
|
41
|
+
var JwtHelper_1 = require("./JwtHelper");
|
|
41
42
|
var TokenService;
|
|
42
43
|
(function (TokenService) {
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* @
|
|
45
|
+
* To get a new token with the grant type refresh_token, call **renewToken()**.
|
|
46
|
+
* 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
|
|
47
|
+
* @example
|
|
48
|
+
* ```js
|
|
49
|
+
* const options = {
|
|
50
|
+
* refresh_token: "your refresh token",
|
|
51
|
+
* }
|
|
52
|
+
*
|
|
53
|
+
* cidaas.renewToken(options)
|
|
54
|
+
* .then(function (response) {
|
|
55
|
+
* // type your code here
|
|
56
|
+
* })
|
|
57
|
+
* .catch(function (ex) {
|
|
58
|
+
* // your failure code here
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
47
61
|
*/
|
|
48
62
|
function renewToken(options) {
|
|
49
63
|
if (!options.refresh_token) {
|
|
@@ -52,14 +66,27 @@ var TokenService;
|
|
|
52
66
|
options.client_id = window.webAuthSettings.client_id;
|
|
53
67
|
options.grant_type = 'refresh_token';
|
|
54
68
|
var _serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
55
|
-
return Helper_1.Helper.
|
|
69
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST");
|
|
56
70
|
}
|
|
57
71
|
TokenService.renewToken = renewToken;
|
|
58
72
|
;
|
|
59
73
|
/**
|
|
60
|
-
* get
|
|
61
|
-
*
|
|
62
|
-
* @
|
|
74
|
+
* To get a new token with the grant type authorization_code, call **getAccessToken()** with code to create a new token.
|
|
75
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/4ff850f48629a-generate-token for more details.
|
|
76
|
+
* @example
|
|
77
|
+
* ```js
|
|
78
|
+
* const options = {
|
|
79
|
+
* code: "your code to be exchanged with access token",
|
|
80
|
+
* }
|
|
81
|
+
*
|
|
82
|
+
* cidaas.getAccessToken(options)
|
|
83
|
+
* .then(function (response) {
|
|
84
|
+
* // type your code here
|
|
85
|
+
* })
|
|
86
|
+
* .catch(function (ex) {
|
|
87
|
+
* // your failure code here
|
|
88
|
+
* });
|
|
89
|
+
* ```
|
|
63
90
|
*/
|
|
64
91
|
function getAccessToken(options) {
|
|
65
92
|
var _a;
|
|
@@ -82,7 +109,7 @@ var TokenService;
|
|
|
82
109
|
_b.label = 2;
|
|
83
110
|
case 2:
|
|
84
111
|
_serviceURL = window.webAuthSettings.authority + "/token-srv/token";
|
|
85
|
-
return [2 /*return*/, Helper_1.Helper.
|
|
112
|
+
return [2 /*return*/, Helper_1.Helper.createHttpPromise(options, _serviceURL, undefined, "POST")];
|
|
86
113
|
}
|
|
87
114
|
});
|
|
88
115
|
});
|
|
@@ -90,56 +117,113 @@ var TokenService;
|
|
|
90
117
|
TokenService.getAccessToken = getAccessToken;
|
|
91
118
|
;
|
|
92
119
|
/**
|
|
93
|
-
* validate access token
|
|
94
|
-
*
|
|
95
|
-
* @
|
|
120
|
+
* To validate an access token, call **validateAccessToken()**.
|
|
121
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/26ff31e2937f1-introspect-with-bearer-token for more details.
|
|
122
|
+
* @example
|
|
123
|
+
* ```js
|
|
124
|
+
* const options = {
|
|
125
|
+
* token: "your access token",
|
|
126
|
+
* token_type_hint: "accepted token type hints are access_token, id_token, refresh_token, sso",
|
|
127
|
+
* }
|
|
128
|
+
*
|
|
129
|
+
* cidaas.validateAccessToken(options)
|
|
130
|
+
* .then(function (response) {
|
|
131
|
+
* // type your code here
|
|
132
|
+
* })
|
|
133
|
+
* .catch(function (ex) {
|
|
134
|
+
* // your failure code here
|
|
135
|
+
* });
|
|
136
|
+
* ```
|
|
96
137
|
*/
|
|
97
138
|
function validateAccessToken(options) {
|
|
98
139
|
if (!options.token || !options.token_type_hint) {
|
|
99
140
|
throw new Helper_1.CustomException("token or token_type_hint cannot be empty", 417);
|
|
100
141
|
}
|
|
101
142
|
var _serviceURL = window.webAuthSettings.authority + "/token-srv/introspect";
|
|
102
|
-
return Helper_1.Helper.
|
|
143
|
+
return Helper_1.Helper.createHttpPromise(options, _serviceURL, false, "POST", options.token);
|
|
103
144
|
}
|
|
104
145
|
TokenService.validateAccessToken = validateAccessToken;
|
|
105
146
|
;
|
|
106
147
|
/**
|
|
107
|
-
* get
|
|
108
|
-
*
|
|
109
|
-
* @
|
|
148
|
+
* To get precheck result after login, call **loginPrecheck()**. If there is missing information, user will be redirected to either accepting consent, changing password, continuing MFA process, or do progressive registration
|
|
149
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/aappczju1t3uh-precheck-information for more details.
|
|
150
|
+
* @example
|
|
151
|
+
* ```js
|
|
152
|
+
* const options = {
|
|
153
|
+
* trackId: "your track id from login",
|
|
154
|
+
* locale: "your preferred locale",
|
|
155
|
+
* }
|
|
156
|
+
*
|
|
157
|
+
* cidaas.loginPrecheck(options)
|
|
158
|
+
* .then(function (response) {
|
|
159
|
+
* // type your code here
|
|
160
|
+
* })
|
|
161
|
+
* .catch(function (ex) {
|
|
162
|
+
* // your failure code here
|
|
163
|
+
* });
|
|
164
|
+
* ```
|
|
110
165
|
*/
|
|
111
|
-
function
|
|
166
|
+
function loginPrecheck(options) {
|
|
112
167
|
var _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + options.track_id + "?acceptLanguage=" + options.locale;
|
|
113
|
-
return Helper_1.Helper.
|
|
168
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
114
169
|
}
|
|
115
|
-
TokenService.
|
|
170
|
+
TokenService.loginPrecheck = loginPrecheck;
|
|
116
171
|
;
|
|
117
172
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* @
|
|
121
|
-
*
|
|
173
|
+
* To get the missing fields after login, call **getMissingFields()**.
|
|
174
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/aappczju1t3uh-precheck-information for more details.
|
|
175
|
+
* @example
|
|
176
|
+
* ```js
|
|
177
|
+
* const trackId = "your track id from login";
|
|
178
|
+
* cidaas.getMissingFields(trackId)
|
|
179
|
+
* .then(function (response) {
|
|
180
|
+
* // type your code here
|
|
181
|
+
* })
|
|
182
|
+
* .catch(function (ex) {
|
|
183
|
+
* // your failure code here
|
|
184
|
+
* });
|
|
185
|
+
* ```
|
|
122
186
|
*/
|
|
123
|
-
function
|
|
124
|
-
var _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/
|
|
125
|
-
return Helper_1.Helper.
|
|
187
|
+
function getMissingFields(trackId) {
|
|
188
|
+
var _serviceURL = window.webAuthSettings.authority + "/token-srv/prelogin/metadata/" + trackId;
|
|
189
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
126
190
|
}
|
|
127
|
-
TokenService.
|
|
191
|
+
TokenService.getMissingFields = getMissingFields;
|
|
128
192
|
;
|
|
129
193
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* @
|
|
194
|
+
* To initiate device code, call **initiateDeviceCode()**.
|
|
195
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/b6d284f55be5e-authorization-request for more details.
|
|
196
|
+
* @example
|
|
197
|
+
* ```js
|
|
198
|
+
* const clientId = "your client id";
|
|
199
|
+
* cidaas.initiateDeviceCode(clientId)
|
|
200
|
+
* .then(function (response) {
|
|
201
|
+
* // type your code here
|
|
202
|
+
* })
|
|
203
|
+
* .catch(function (ex) {
|
|
204
|
+
* // your failure code here
|
|
205
|
+
* });
|
|
206
|
+
* ```
|
|
133
207
|
*/
|
|
134
|
-
function
|
|
135
|
-
var
|
|
136
|
-
|
|
208
|
+
function initiateDeviceCode(clientId) {
|
|
209
|
+
var clientid = clientId !== null && clientId !== void 0 ? clientId : window.webAuthSettings.client_id;
|
|
210
|
+
var _serviceURL = "".concat(window.webAuthSettings.authority, "/authz-srv/device/authz?client_id=").concat(clientid);
|
|
211
|
+
return Helper_1.Helper.createHttpPromise(undefined, _serviceURL, false, "GET");
|
|
137
212
|
}
|
|
138
|
-
TokenService.
|
|
139
|
-
;
|
|
213
|
+
TokenService.initiateDeviceCode = initiateDeviceCode;
|
|
140
214
|
/**
|
|
141
|
-
* device code
|
|
142
|
-
* @
|
|
215
|
+
* To verify device code, call **deviceCodeVerify()**.
|
|
216
|
+
* @example
|
|
217
|
+
* ```js
|
|
218
|
+
* const code = "your code which has been send after initiateDeviceCode()";
|
|
219
|
+
* cidaas.deviceCodeVerify(code)
|
|
220
|
+
* .then(function (response) {
|
|
221
|
+
* // type your code here
|
|
222
|
+
* })
|
|
223
|
+
* .catch(function (ex) {
|
|
224
|
+
* // your failure code here
|
|
225
|
+
* });
|
|
226
|
+
* ```
|
|
143
227
|
*/
|
|
144
228
|
function deviceCodeVerify(code) {
|
|
145
229
|
var params = "user_code=".concat(encodeURI(code));
|
|
@@ -157,4 +241,45 @@ var TokenService;
|
|
|
157
241
|
}
|
|
158
242
|
}
|
|
159
243
|
TokenService.deviceCodeVerify = deviceCodeVerify;
|
|
244
|
+
/**
|
|
245
|
+
* To check access token without having to call cidaas api, call **offlineTokenCheck()**. THe function will return true if the token is valid & false if the token is invalid.
|
|
246
|
+
* @example
|
|
247
|
+
* ```js
|
|
248
|
+
* cidaas.offlineTokenCheck('your access token');
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
function offlineTokenCheck(accessToken) {
|
|
252
|
+
var _a, _b;
|
|
253
|
+
var result = {
|
|
254
|
+
isExpiryDateValid: false,
|
|
255
|
+
isScopesValid: false,
|
|
256
|
+
isIssuerValid: false
|
|
257
|
+
};
|
|
258
|
+
var accessTokenHeaderAsJson = JwtHelper_1.JwtHelper.decodeTokenHeader(accessToken);
|
|
259
|
+
var accessTokenAsJson = JwtHelper_1.JwtHelper.decodeToken(accessToken);
|
|
260
|
+
if (!accessTokenAsJson || !accessTokenHeaderAsJson) {
|
|
261
|
+
return result;
|
|
262
|
+
}
|
|
263
|
+
else {
|
|
264
|
+
if (accessTokenAsJson.exp) {
|
|
265
|
+
var expirationDate = new Date(0);
|
|
266
|
+
expirationDate.setUTCSeconds(accessTokenAsJson.exp);
|
|
267
|
+
result.isExpiryDateValid = expirationDate.valueOf() > new Date().valueOf();
|
|
268
|
+
}
|
|
269
|
+
var accessTokenScopes_1 = accessTokenAsJson.scopes;
|
|
270
|
+
var webAuthSettingScopes = (_b = (_a = window.webAuthSettings) === null || _a === void 0 ? void 0 : _a.scope) === null || _b === void 0 ? void 0 : _b.split(' ');
|
|
271
|
+
if ((accessTokenScopes_1 === null || accessTokenScopes_1 === void 0 ? void 0 : accessTokenScopes_1.length) === (webAuthSettingScopes === null || webAuthSettingScopes === void 0 ? void 0 : webAuthSettingScopes.length)) {
|
|
272
|
+
webAuthSettingScopes.forEach(function (webAuthSettingScope) {
|
|
273
|
+
var i = accessTokenScopes_1.indexOf(webAuthSettingScope);
|
|
274
|
+
if (i > -1) {
|
|
275
|
+
accessTokenScopes_1.splice(i, 1);
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
result.isScopesValid = accessTokenScopes_1.length === 0;
|
|
279
|
+
}
|
|
280
|
+
result.isIssuerValid = accessTokenAsJson.iss === window.webAuthSettings.authority;
|
|
281
|
+
}
|
|
282
|
+
return result;
|
|
283
|
+
}
|
|
284
|
+
TokenService.offlineTokenCheck = offlineTokenCheck;
|
|
160
285
|
})(TokenService = exports.TokenService || (exports.TokenService = {}));
|
|
@@ -1,18 +1,51 @@
|
|
|
1
1
|
import { UserEntity, ResetPasswordEntity, FindUserEntity, IUserLinkEntity, ChangePasswordEntity, ValidateResetPasswordEntity, AcceptResetPasswordEntity } from "./Entities";
|
|
2
2
|
export declare namespace UserService {
|
|
3
3
|
/**
|
|
4
|
-
* get user
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
4
|
+
* To get the user profile information by using cidaas internal api, call **getUserProfile()**.
|
|
5
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/2zfvjx3vtq6g6-get-user-info for more details.
|
|
6
|
+
* @example
|
|
7
|
+
* ```js
|
|
8
|
+
* const options = {
|
|
9
|
+
* access_token: 'your access token'
|
|
10
|
+
* }
|
|
11
|
+
* cidaas.getUserProfile(options)
|
|
12
|
+
* .then(function () {
|
|
13
|
+
* // the response will give you user profile information.
|
|
14
|
+
* }).catch(function (ex) {
|
|
15
|
+
* // your failure code here
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
7
18
|
*/
|
|
8
19
|
function getUserProfile(options: {
|
|
9
20
|
access_token: string;
|
|
10
21
|
}): Promise<unknown>;
|
|
11
22
|
/**
|
|
12
|
-
* register user
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @
|
|
23
|
+
* To register user, call **register()**. This method will create a new user.
|
|
24
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/427632e587203-register-a-new-user for more details.
|
|
25
|
+
* Note: Only requestId in the headers is required.
|
|
26
|
+
* @example
|
|
27
|
+
* ```js
|
|
28
|
+
* const headers = {
|
|
29
|
+
* requestId: 'your_received_requestId',
|
|
30
|
+
* captcha: 'captcha',
|
|
31
|
+
* acceptlanguage: 'acceptlanguage',
|
|
32
|
+
* bot_captcha_response: 'bot_captcha_response'
|
|
33
|
+
* };
|
|
34
|
+
*
|
|
35
|
+
* cidaas.register({
|
|
36
|
+
* email: 'xxx123@xxx.com',
|
|
37
|
+
* given_name: 'xxxxx',
|
|
38
|
+
* family_name: 'yyyyy',
|
|
39
|
+
* password: '123456',
|
|
40
|
+
* password_echo: '123456',
|
|
41
|
+
* provider: 'your provider', // FACEBOOK, GOOGLE, SELF
|
|
42
|
+
* acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
43
|
+
* }, headers).then(function (response) {
|
|
44
|
+
* // the response will give you client registration details.
|
|
45
|
+
* }).catch(function(ex) {
|
|
46
|
+
* // your failure code here
|
|
47
|
+
* });
|
|
48
|
+
*```
|
|
16
49
|
*/
|
|
17
50
|
function register(options: UserEntity, headers: {
|
|
18
51
|
requestId: string;
|
|
@@ -22,49 +55,121 @@ export declare namespace UserService {
|
|
|
22
55
|
trackId?: string;
|
|
23
56
|
}): Promise<unknown>;
|
|
24
57
|
/**
|
|
25
|
-
* get
|
|
26
|
-
* @
|
|
27
|
-
*
|
|
58
|
+
* to get information about invitation details, call **getInviteUserDetails()**
|
|
59
|
+
* @example
|
|
60
|
+
* ```js
|
|
61
|
+
* const options = {
|
|
62
|
+
* invite_id: 'id of user invitation'
|
|
63
|
+
* }
|
|
64
|
+
* cidaas.getInviteUserDetails(options)
|
|
65
|
+
* .then(function () {
|
|
66
|
+
* // the response will give you information about the invitation.
|
|
67
|
+
* }).catch(function (ex) {
|
|
68
|
+
* // your failure code here
|
|
69
|
+
* });
|
|
70
|
+
* ```
|
|
28
71
|
*/
|
|
29
72
|
function getInviteUserDetails(options: {
|
|
30
73
|
invite_id: string;
|
|
31
74
|
}): Promise<unknown>;
|
|
32
75
|
/**
|
|
33
|
-
* get
|
|
34
|
-
* @
|
|
35
|
-
*
|
|
76
|
+
* Once registration successful, verify the account based on the flow. To get the details, call **getCommunicationStatus()**.
|
|
77
|
+
* @example
|
|
78
|
+
* ```js
|
|
79
|
+
* cidaas.getCommunicationStatus({
|
|
80
|
+
* sub: 'your sub', // which you will get on the registration response
|
|
81
|
+
* }).then(function (response) {
|
|
82
|
+
* // the response will give you account details once its verified.
|
|
83
|
+
* }).catch(function(ex) {
|
|
84
|
+
* // your failure code here
|
|
85
|
+
* });
|
|
86
|
+
* ```
|
|
36
87
|
*/
|
|
37
88
|
function getCommunicationStatus(options: {
|
|
38
89
|
sub: string;
|
|
90
|
+
}, headers?: {
|
|
39
91
|
requestId: string;
|
|
40
92
|
}): Promise<unknown>;
|
|
41
93
|
/**
|
|
42
|
-
* initiate
|
|
43
|
-
*
|
|
44
|
-
* @
|
|
94
|
+
* To initiate the password resetting, call **initiateResetPassword()**. This will send verification code to your email or mobile based on the resetMedium you mentioned.
|
|
95
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/6b29bac6002f4-initiate-password-reset for more details.
|
|
96
|
+
* @example
|
|
97
|
+
* ```js
|
|
98
|
+
* cidaas.initiateResetPassword({
|
|
99
|
+
* email: 'xxxxxx@xxx.com',
|
|
100
|
+
* processingType: 'CODE',
|
|
101
|
+
* requestId: 'your requestId',
|
|
102
|
+
* resetMedium: 'email'
|
|
103
|
+
* }).then(function (response) {
|
|
104
|
+
* // the response will give you password reset details.
|
|
105
|
+
* }).catch(function(ex) {
|
|
106
|
+
* // your failure code here
|
|
107
|
+
* });
|
|
108
|
+
* ```
|
|
45
109
|
*/
|
|
46
110
|
function initiateResetPassword(options: ResetPasswordEntity): Promise<unknown>;
|
|
47
111
|
/**
|
|
48
|
-
* handle reset password
|
|
49
|
-
*
|
|
112
|
+
* To handle the reset password by entering the verification code you received, call **handleResetPassword()**. This will check if your verification code was valid or not, and allows you to proceed to the next step.
|
|
113
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/3t8ztokeb7cfz-handle-reset-password for more details.
|
|
114
|
+
* @example
|
|
115
|
+
* ```js
|
|
116
|
+
* const handleResponseAsJson = 'true if the response need to be handled the old way (as json). In the current handling, the response information will be given as query parameter in redirect url.';
|
|
117
|
+
* cidaas.handleResetPassword({
|
|
118
|
+
* code: 'your code in email or sms or ivr',
|
|
119
|
+
* resetRequestId: 'your resetRequestId' // which you will get on initiate reset password response
|
|
120
|
+
* }, handleResponseAsJson).then(function (response) {
|
|
121
|
+
* // the response will give you valid verification code.
|
|
122
|
+
* }).catch(function(ex) {
|
|
123
|
+
* // your failure code here
|
|
124
|
+
* });
|
|
125
|
+
* ```
|
|
50
126
|
*/
|
|
51
|
-
function handleResetPassword(options: ValidateResetPasswordEntity): Promise<unknown>;
|
|
127
|
+
function handleResetPassword(options: ValidateResetPasswordEntity, handleResponseAsJson?: boolean): Promise<unknown>;
|
|
52
128
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
129
|
+
* To finish reseting the password, call **resetPassword()**. This will allow you to change your password.
|
|
130
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/qa9ny0gkzlf6y-accept-reset-password for more details.
|
|
131
|
+
* @example
|
|
132
|
+
* ```js
|
|
133
|
+
* const handleResponseAsJson = 'true if the response need to be handled the old way (as json). In the current handling, user will be redirected to success page after successful reset password.';
|
|
134
|
+
* cidaas.resetPassword({
|
|
135
|
+
* password: '123456',
|
|
136
|
+
* confirmPassword: '123456',
|
|
137
|
+
* exchangeId: 'your exchangeId', // which you will get on handle reset password response
|
|
138
|
+
* resetRequestId: 'your resetRequestId' // which you will get on handle reset password response
|
|
139
|
+
* }).then(function (response) {
|
|
140
|
+
* // the response will give you reset password details.
|
|
141
|
+
* }).catch(function(ex) {
|
|
142
|
+
* // your failure code here
|
|
143
|
+
* });
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
function resetPassword(options: AcceptResetPasswordEntity, handleResponseAsJson?: boolean): Promise<unknown>;
|
|
57
147
|
/**
|
|
58
|
-
* get
|
|
59
|
-
* @
|
|
60
|
-
*
|
|
148
|
+
* To get the list of existing users in deduplication, call **getDeduplicationDetails()**.
|
|
149
|
+
* @example
|
|
150
|
+
* ```js
|
|
151
|
+
* this.cidaas.getDeduplicationDetails({
|
|
152
|
+
* track_id: 'your track id'
|
|
153
|
+
* }).then((response) => {
|
|
154
|
+
* // the response will give you deduplication details of users.
|
|
155
|
+
* }).catch((err) => {
|
|
156
|
+
* // your failure code here
|
|
157
|
+
* });
|
|
158
|
+
* ```
|
|
61
159
|
*/
|
|
62
160
|
function getDeduplicationDetails(options: {
|
|
63
161
|
trackId: string;
|
|
64
162
|
}): Promise<unknown>;
|
|
65
163
|
/**
|
|
66
|
-
* deduplication
|
|
67
|
-
* @
|
|
164
|
+
* To use the existing users in deduplication, you need to call **deduplicationLogin()**.
|
|
165
|
+
* @example
|
|
166
|
+
* ```js
|
|
167
|
+
* this.cidaas.deduplicationLogin({
|
|
168
|
+
* sub: 'your sub',
|
|
169
|
+
* requestId: 'request id from deduplication initialisation after register',
|
|
170
|
+
* trackId: 'track id from deduplication initialisation after register'
|
|
171
|
+
* })
|
|
172
|
+
* ```
|
|
68
173
|
*/
|
|
69
174
|
function deduplicationLogin(options: {
|
|
70
175
|
trackId: string;
|
|
@@ -72,72 +177,165 @@ export declare namespace UserService {
|
|
|
72
177
|
sub: string;
|
|
73
178
|
}): void;
|
|
74
179
|
/**
|
|
75
|
-
* register
|
|
76
|
-
* @
|
|
77
|
-
*
|
|
180
|
+
* To register new user in deduplication, call **registerDeduplication()**.
|
|
181
|
+
* @example
|
|
182
|
+
* ```js
|
|
183
|
+
* this.cidaas.registerDeduplication({
|
|
184
|
+
* track_id: 'track id from deduplication initialisation after register',
|
|
185
|
+
* }).then((response) => {
|
|
186
|
+
* // the response will give you new registered deduplication user.
|
|
187
|
+
* }).catch((err) => {
|
|
188
|
+
* // your failure code here
|
|
189
|
+
* });
|
|
190
|
+
* ```
|
|
78
191
|
*/
|
|
79
192
|
function registerDeduplication(options: {
|
|
80
193
|
trackId: string;
|
|
81
194
|
}): Promise<unknown>;
|
|
82
195
|
/**
|
|
83
|
-
* change password
|
|
84
|
-
*
|
|
85
|
-
* @
|
|
86
|
-
*
|
|
196
|
+
* To change the password, call **changePassword()**. This will allow you to change your password.
|
|
197
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/8221883241464-change-password for more details.
|
|
198
|
+
* @example
|
|
199
|
+
* ```js
|
|
200
|
+
* cidaas.changePassword({
|
|
201
|
+
* old_password: 'your old password',
|
|
202
|
+
* new_password: 'your new password',
|
|
203
|
+
* confirm_password: 'your new password',
|
|
204
|
+
* sub: 'your sub',
|
|
205
|
+
* }, 'your access token')
|
|
206
|
+
* .then(function () {
|
|
207
|
+
* // your success code
|
|
208
|
+
* }).catch(function (ex) {
|
|
209
|
+
* // your failure code
|
|
210
|
+
* });
|
|
211
|
+
* ```
|
|
87
212
|
*/
|
|
88
213
|
function changePassword(options: ChangePasswordEntity, access_token: string): Promise<unknown>;
|
|
89
214
|
/**
|
|
90
|
-
* update profile
|
|
91
|
-
*
|
|
92
|
-
* @
|
|
93
|
-
*
|
|
94
|
-
*
|
|
215
|
+
* To update the user profile information, call **updateProfile()**.
|
|
216
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/i3uqnxcpxr19r-update-user-profile for more details.
|
|
217
|
+
* @example
|
|
218
|
+
* ```js
|
|
219
|
+
* cidaas.updateProfile({
|
|
220
|
+
* family_name: 'Doe',
|
|
221
|
+
* given_name: 'John',
|
|
222
|
+
* provider: 'self',
|
|
223
|
+
* acceptlanguage: 'your locale' // optional example: de-de, en-US
|
|
224
|
+
* }, 'your access token', 'your sub').then(function () {
|
|
225
|
+
* // the response will give you updated user profile info.
|
|
226
|
+
* }).catch(function (ex) {
|
|
227
|
+
* // your failure code here
|
|
228
|
+
* });
|
|
229
|
+
* ```
|
|
95
230
|
*/
|
|
96
231
|
function updateProfile(options: UserEntity, access_token: string, sub: string): Promise<unknown>;
|
|
97
232
|
/**
|
|
98
|
-
* initiate
|
|
99
|
-
* @
|
|
100
|
-
*
|
|
101
|
-
*
|
|
233
|
+
* To initiate account linking, call **initiateLinkAccount()**.
|
|
234
|
+
* @example
|
|
235
|
+
* ```js
|
|
236
|
+
* const options = {
|
|
237
|
+
* master_sub: 'sub of the user who initiates the user link',
|
|
238
|
+
* user_name_to_link: 'username of the user which should get linked',
|
|
239
|
+
* user_name_type: 'type of user name to link. E.g. email'
|
|
240
|
+
* }
|
|
241
|
+
* const access_token = 'your access token'
|
|
242
|
+
* this.cidaas.initiateLinkAccount(options, access_token).then((response) => {
|
|
243
|
+
* // your success code
|
|
244
|
+
* }).catch((err) => {
|
|
245
|
+
* // your failure code here
|
|
246
|
+
* });
|
|
247
|
+
* ```
|
|
102
248
|
*/
|
|
103
249
|
function initiateLinkAccount(options: IUserLinkEntity, access_token: string): Promise<unknown>;
|
|
104
250
|
/**
|
|
105
|
-
* complete
|
|
106
|
-
* @
|
|
107
|
-
*
|
|
108
|
-
*
|
|
251
|
+
* To complete account linking, call **completeLinkAccount()**.
|
|
252
|
+
* @example
|
|
253
|
+
* ```js
|
|
254
|
+
* const options = {
|
|
255
|
+
* code: 'code which is sent to account to be linked',
|
|
256
|
+
* link_request_id: 'comes from initiateLinkAccount'
|
|
257
|
+
* }
|
|
258
|
+
* const access_token = 'your access token'
|
|
259
|
+
* this.cidaas.completeLinkAccount(options, access_token).then((response) => {
|
|
260
|
+
* // your success code
|
|
261
|
+
* }).catch((err) => {
|
|
262
|
+
* // your failure code here
|
|
263
|
+
* });
|
|
264
|
+
* ```
|
|
109
265
|
*/
|
|
110
266
|
function completeLinkAccount(options: {
|
|
111
267
|
code?: string;
|
|
112
268
|
link_request_id?: string;
|
|
113
269
|
}, access_token: string): Promise<unknown>;
|
|
114
270
|
/**
|
|
115
|
-
* get linked
|
|
116
|
-
* @
|
|
117
|
-
*
|
|
118
|
-
*
|
|
271
|
+
* To get all the linked accounts, call **getLinkedUsers()**.
|
|
272
|
+
* @example
|
|
273
|
+
* ```js
|
|
274
|
+
* const acccess_token= 'your access token';
|
|
275
|
+
* const sub = 'your sub';
|
|
276
|
+
*
|
|
277
|
+
* cidaas.getLinkedUsers(access_token, sub)
|
|
278
|
+
* .then(function (response) {
|
|
279
|
+
* // type your code here
|
|
280
|
+
* })
|
|
281
|
+
* .catch(function (ex) {
|
|
282
|
+
* // your failure code here
|
|
283
|
+
* });
|
|
284
|
+
* ```
|
|
119
285
|
*/
|
|
120
286
|
function getLinkedUsers(access_token: string, sub: string): Promise<unknown>;
|
|
121
287
|
/**
|
|
122
|
-
* unlink
|
|
123
|
-
* @
|
|
124
|
-
*
|
|
125
|
-
*
|
|
288
|
+
* To unlink an account for a user, call **unlinkAccount()**.
|
|
289
|
+
* @example
|
|
290
|
+
* ```js
|
|
291
|
+
* const acccess_token= "your access token";
|
|
292
|
+
* const identityId = "comes from getLinkedUsers";
|
|
293
|
+
*
|
|
294
|
+
* cidaas.unlinkAccount(access_token, identityId)
|
|
295
|
+
* .then(function (response) {
|
|
296
|
+
* // type your code here
|
|
297
|
+
* })
|
|
298
|
+
* .catch(function (ex) {
|
|
299
|
+
* // your failure code here
|
|
300
|
+
* });
|
|
301
|
+
* ```
|
|
126
302
|
*/
|
|
127
303
|
function unlinkAccount(access_token: string, identityId: string): Promise<unknown>;
|
|
128
304
|
/**
|
|
129
|
-
* deleteUserAccount
|
|
130
|
-
*
|
|
131
|
-
* @
|
|
305
|
+
* To delete the user account directly in the application, call **deleteUserAccount()**.
|
|
306
|
+
* Please refer to the api document https://docs.cidaas.com/docs/cidaas-iam/x133xdifl1sx9-schedule-user-deletion for more details.
|
|
307
|
+
* @example
|
|
308
|
+
* ```js
|
|
309
|
+
* options = {
|
|
310
|
+
* access_token: "your access token",
|
|
311
|
+
* sub: "your sub"
|
|
312
|
+
* }
|
|
313
|
+
*
|
|
314
|
+
* cidaas.deleteUserAccount(options).then(function (response) {
|
|
315
|
+
* // your success code
|
|
316
|
+
* }).catch(function(ex) {
|
|
317
|
+
* // your failure code here
|
|
318
|
+
* });
|
|
319
|
+
* ```
|
|
132
320
|
*/
|
|
133
321
|
function deleteUserAccount(options: {
|
|
134
322
|
access_token: string;
|
|
135
323
|
sub: string;
|
|
136
324
|
}): Promise<unknown>;
|
|
137
325
|
/**
|
|
138
|
-
* check if
|
|
139
|
-
* @
|
|
140
|
-
*
|
|
326
|
+
* To check if user exists, call **userCheckExists()**.
|
|
327
|
+
* @example
|
|
328
|
+
* options = {
|
|
329
|
+
* requestId: "your request id",
|
|
330
|
+
* email: "your email"
|
|
331
|
+
* }
|
|
332
|
+
*
|
|
333
|
+
* cidaas.userCheckExists(options).then(function (response) {
|
|
334
|
+
* // your success code
|
|
335
|
+
* }).catch(function(ex) {
|
|
336
|
+
* // your failure code here
|
|
337
|
+
* });
|
|
338
|
+
* ```
|
|
141
339
|
*/
|
|
142
340
|
function userCheckExists(options: FindUserEntity): Promise<unknown>;
|
|
143
341
|
}
|