@asgardeo/auth-react 1.1.19 → 2.0.0

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.
@@ -0,0 +1,946 @@
1
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
2
+
3
+ /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
4
+
5
+ /**
6
+ *
7
+ * This method initializes the SDK with the config data.
8
+ *
9
+ * @param config - The config object to initialize with.
10
+ *
11
+ * @example
12
+ * const config = \{
13
+ * signInRedirectURL: "http://localhost:3000/sign-in",
14
+ * clientID: "client ID",
15
+ * baseUrl: "https://localhost:9443"
16
+ * \}
17
+ *
18
+ * await auth.initialize(config);
19
+ *
20
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#initialize}
21
+ *
22
+ * @preserve
23
+ */
24
+
25
+ /**
26
+ * This is an async method that returns a Promise that resolves with the authorization URL.
27
+ *
28
+ * @param config - (Optional) A config object to force initialization and pass
29
+ * custom path parameters such as the fidp parameter.
30
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
31
+ * scenarios where each user should be uniquely identified.
32
+ *
33
+ * @returns - A promise that resolves with the authorization URL.
34
+ *
35
+ * @example
36
+ * ```
37
+ * auth.getAuthorizationURL().then((url)=>{
38
+ * // console.log(url);
39
+ * }).catch((error)=>{
40
+ * // console.error(error);
41
+ * });
42
+ * ```
43
+ *
44
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getAuthorizationURL}
45
+ *
46
+ * @preserve
47
+ */
48
+
49
+ /**
50
+ * This is an async method that sends a request to obtain the access token and returns a Promise
51
+ * that resolves with the token and other relevant data.
52
+ *
53
+ * @param authorizationCode - The authorization code.
54
+ * @param sessionState - The session state.
55
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
56
+ * scenarios where each user should be uniquely identified.
57
+ *
58
+ * @returns - A Promise that resolves with the token response.
59
+ *
60
+ * @example
61
+ * ```
62
+ * auth.requestAccessToken(authCode, sessionState).then((token)=>{
63
+ * // console.log(token);
64
+ * }).catch((error)=>{
65
+ * // console.error(error);
66
+ * });
67
+ * ```
68
+ *
69
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#requestAccessToken}
70
+ *
71
+ *
72
+ * @preserve
73
+ */
74
+
75
+ /**
76
+ * This is the constructor method that returns an instance of the .
77
+ *
78
+ * @param store - The store object.
79
+ *
80
+ * @example
81
+ * ```
82
+ * const _store: Store = new DataStore();
83
+ * const auth = new AsgardeoAuthClient<CustomClientConfig>(_store);
84
+ * ```
85
+ *
86
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#constructor}
87
+ *
88
+ * @preserve
89
+ */
90
+
91
+ /**
92
+ * This method allows you to send a request with a custom grant.
93
+ *
94
+ * @param {CustomGrantRequestParams} config - The request parameters.
95
+ *
96
+ * @return {Promise<HttpResponse<any> | SignInResponse>} - A Promise that resolves with
97
+ * the value returned by the custom grant request.
98
+ *
99
+ * @example
100
+ * ```
101
+ * auth.customGrant({
102
+ * attachToken: false,
103
+ * data: {
104
+ * client_id: "{{clientId}}",
105
+ * grant_type: "account_switch",
106
+ * scope: "{{scope}}",
107
+ * token: "{{token}}",
108
+ * },
109
+ * id: "account-switch",
110
+ * returnResponse: true,
111
+ * returnsSession: true,
112
+ * signInRequired: true
113
+ * });
114
+ * ```
115
+ *
116
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#customgrant
117
+ *
118
+ * @memberof AsgardeoSPAClient
119
+ *
120
+ * @preserve
121
+ */
122
+
123
+ /**
124
+ * This method decodes the payload of the ID token and returns it.
125
+ *
126
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
127
+ * scenarios where each user should be uniquely identified.
128
+ *
129
+ * @returns - A Promise that resolves with the decoded ID token payload.
130
+ *
131
+ * @example
132
+ * ```
133
+ * const decodedIdToken = await auth.getDecodedIDToken();
134
+ * ```
135
+ *
136
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getDecodedIDToken}
137
+ *
138
+ * @preserve
139
+ */
140
+
141
+ /**
142
+ * This method decodes the payload of the id token and returns it.
143
+ *
144
+ * @return {Promise<DecodedIdTokenPayloadInterface>} - A Promise that resolves with
145
+ * the decoded payload of the id token.
146
+ *
147
+ * @example
148
+ * ```
149
+ * auth.getDecodedIDToken().then((response)=>{
150
+ * // console.log(response);
151
+ * }).catch((error)=>{
152
+ * // console.error(error);
153
+ * });
154
+ * ```
155
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getdecodedidtoken
156
+ *
157
+ * @memberof AsgardeoSPAClient
158
+ *
159
+ * @preserve
160
+ */
161
+
162
+ /**
163
+ * This method disables callback functions attached to the http client.
164
+ *
165
+ * @return {Promise<boolean>} - A promise that resolves with True.
166
+ *
167
+ * @example
168
+ * ```
169
+ * auth.disableHttpHandler();
170
+ * ```
171
+ *
172
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#disableHttpHandler
173
+ *
174
+ * @memberof AsgardeoSPAClient
175
+ *
176
+ * @preserve
177
+ */
178
+
179
+ /**
180
+ * This method enables callback functions attached to the http client.
181
+ *
182
+ * @return {Promise<boolean>} - A promise that resolves with True.
183
+ *
184
+ * @example
185
+ * ```
186
+ * auth.enableHttpHandler();
187
+ * ```
188
+ *
189
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#enableHttpHandler
190
+ *
191
+ * @memberof AsgardeoSPAClient
192
+ *
193
+ * @preserve
194
+ */
195
+
196
+ /**
197
+ * This method ends a user session. The access token is revoked and the session information is destroyed.
198
+ *
199
+ * **To fire a callback function after ending user session, use the `on()` method.**
200
+ * **To learn more about the `on()` method:**
201
+ * @see {@link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#on}
202
+ *
203
+ * @return {Promise<boolean>} - A promise that resolves with `true` if the process is successful.
204
+ *
205
+ * @example
206
+ * ```
207
+ * auth.endUserSession();
208
+ * ```
209
+ *
210
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#endusersession
211
+ *
212
+ * @memberof AsgardeoSPAClient
213
+ *
214
+ * @preserve
215
+ */
216
+
217
+ /**
218
+ * This method initializes the `AsgardeoSPAClient` instance.
219
+ *
220
+ * @param {ConfigInterface} config The config object to initialize with.
221
+ *
222
+ * @return {Promise<boolean>} - Resolves to `true` if initialization is successful.
223
+ *
224
+ * @example
225
+ * ```
226
+ * auth.initialize({
227
+ * signInRedirectURL: "http://localhost:3000/sign-in",
228
+ * clientID: "client ID",
229
+ * baseUrl: "https://api.asgardeo.io"
230
+ * });
231
+ * ```
232
+ *
233
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#initialize
234
+ *
235
+ * @memberof AsgardeoSPAClient
236
+ *
237
+ * @preserve
238
+ */
239
+
240
+ /**
241
+ * This method initiates the authentication flow. This should be called twice.
242
+ * 1. To initiate the authentication flow.
243
+ * 2. To obtain the access token after getting the authorization code.
244
+ *
245
+ * To satisfy the second condition, one of the two strategies mentioned below can be used:
246
+ * 1. Redirect the user back to the same login page that initiated the authentication flow.
247
+ * 2. Call the `signIn()` method in the page the user is redirected to after authentication.
248
+ *
249
+ * **To fire a callback function after signing in, use the `on()` method.**
250
+ * **To learn more about the `on()` method:**
251
+ * @see {@link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#on}
252
+ *
253
+ * @param {SignInConfig} config - The sign-in config.
254
+ * The `SignInConfig` object has these two attributes in addition to any custom key-value pairs.
255
+ * 1. fidp - Specifies the FIDP parameter that is used to take the user directly to an IdP login page.
256
+ * 2. forceInit: Specifies if the OIDC Provider Meta Data should be loaded again from the `well-known`
257
+ * endpoint.
258
+ * 3. Any other parameters that should be appended to the authorization request.
259
+ * @param {string} authorizationCode - The authorization code. (Optional)
260
+ * @param {string} sessionState - The session state. (Optional)
261
+ * @param {string} state - The state. (Optional)
262
+ *
263
+ * @return {Promise<BasicUserInfo>} - A promise that resolves with the user information.
264
+ *
265
+ * @example
266
+ * ```
267
+ * auth.signIn();
268
+ * ```
269
+ *
270
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#signin
271
+ *
272
+ * @memberof AsgardeoSPAClient
273
+ *
274
+ * @preserve
275
+ */
276
+
277
+ /**
278
+ * This method initiates the sign-out flow.
279
+ *
280
+ * **To fire a callback function after signing out, use the `on()` method.**
281
+ * **To learn more about the `on()` method:**
282
+ * @see {@link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#on}
283
+ *
284
+ * @return {Promise<boolean>} - Returns a promise that resolves with `true` if sign out is successful.
285
+ *
286
+ * @example
287
+ * ```
288
+ * auth.signOut();
289
+ * ```
290
+ *
291
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#signout
292
+ *
293
+ * @memberof AsgardeoSPAClient
294
+ *
295
+ * @preserve
296
+ */
297
+
298
+ /**
299
+ * This method refreshes the access token and returns a Promise that resolves with the new access
300
+ * token and other relevant data.
301
+ *
302
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
303
+ * scenarios where each user should be uniquely identified.
304
+ *
305
+ * @returns - A Promise that resolves with the token response.
306
+ *
307
+ * @example
308
+ * ```
309
+ * auth.refreshAccessToken().then((response)=>{
310
+ * // console.log(response);
311
+ * }).catch((error)=>{
312
+ * // console.error(error);
313
+ * });
314
+ * ```
315
+ *
316
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#refreshAccessToken}
317
+ *
318
+ * @preserve
319
+ */
320
+
321
+ /**
322
+ * This method refreshes the access token.
323
+ *
324
+ * @return {TokenResponseInterface} - A Promise that resolves with an object containing
325
+ * information about the refreshed access token.
326
+ *
327
+ * @example
328
+ * ```
329
+ * auth.refreshToken().then((response)=>{
330
+ * // console.log(response);
331
+ * }).catch((error)=>{
332
+ * // console.error(error);
333
+ * });
334
+ * ```
335
+ *
336
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#refreshtoken
337
+ *
338
+ * @memberof AsgardeoSPAClient
339
+ *
340
+ * @preserve
341
+ */
342
+
343
+ /**
344
+ * This method return a Promise that resolves with the access token.
345
+ *
346
+ * **This method will not return the access token if the storage type is set to `webWorker`.**
347
+ *
348
+ * @return {Promise<string>} - A Promise that resolves with the access token.
349
+ *
350
+ * @example
351
+ * ```
352
+ * auth.getAccessToken().then((token) => {
353
+ * // console.log(token);
354
+ * }).catch((error) => {
355
+ * // console.error(error);
356
+ * });
357
+ * ```
358
+ *
359
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getaccesstoken
360
+ *
361
+ * @memberof AsgardeoSPAClient
362
+ *
363
+ * @preserve
364
+ */
365
+
366
+ /**
367
+ * This method return a Promise that resolves with the data layer object.
368
+ *
369
+ * **This method will not return the data layer object, if the storage type is set to `webWorker`.**
370
+ *
371
+ * @return {Promise<string>} - A Promise that resolves with the data layer object.
372
+ *
373
+ * @example
374
+ * ```
375
+ * auth.getDataLayer().then((dataLayer) => {
376
+ * // console.log(dataLayer);
377
+ * }).catch((error) => {
378
+ * // console.error(error);
379
+ * });
380
+ * ```
381
+ *
382
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getdatalayer
383
+ *
384
+ * @memberof AsgardeoSPAClient
385
+ *
386
+ * @preserve
387
+ */
388
+
389
+ /**
390
+ * This method return a Promise that resolves with the idp access token.
391
+ *
392
+ * **This method will not return the access token if the storage type is set to `webWorker`.**
393
+ *
394
+ * @return {Promise<string>} - A Promise that resolves with the idp access token.
395
+ *
396
+ * @example
397
+ * ```
398
+ * auth.getIDPAccessToken().then((token) => {
399
+ * // console.log(token);
400
+ * }).catch((error) => {
401
+ * // console.error(error);
402
+ * });
403
+ * ```
404
+ *
405
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getaccesstoken
406
+ *
407
+ * @memberof AsgardeoSPAClient
408
+ *
409
+ * @preserve
410
+ */
411
+
412
+ /**
413
+ * This method return the ID token.
414
+ *
415
+ * @return {Promise<string>} - A Promise that resolves with the ID token.
416
+ *
417
+ * @example
418
+ * ```
419
+ * const idToken = await auth.getIDToken();
420
+ * ```
421
+ *
422
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getIDToken
423
+ *
424
+ * @memberof AsgardeoAuthClient
425
+ *
426
+ * @preserve
427
+ */
428
+
429
+ /**
430
+ * This method returns OIDC service endpoints that are fetched from the `.well-known` endpoint.
431
+ *
432
+ * @returns - A Promise that resolves with an object containing the OIDC service endpoints.
433
+ *
434
+ * @example
435
+ * ```
436
+ * const endpoints = await auth.getOIDCServiceEndpoints();
437
+ * ```
438
+ *
439
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getOIDCServiceEndpoints}
440
+ *
441
+ * @preserve
442
+ */
443
+
444
+ /**
445
+ * This method returns a Promise that resolves with an object containing the service endpoints.
446
+ *
447
+ * @return {Promise<ServiceResourcesType} - A Promise that resolves with an object containing the service endpoints.
448
+ *
449
+ * @example
450
+ * ```
451
+ * auth.getServiceEndpoints().then((endpoints) => {
452
+ * // console.log(endpoints);
453
+ * }).error((error) => {
454
+ * // console.error(error);
455
+ * });
456
+ * ```
457
+ *
458
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getserviceendpoints
459
+ *
460
+ * @memberof AsgardeoSPAClient
461
+ *
462
+ * @preserve
463
+ */
464
+
465
+ /**
466
+ * This method returns a Promise that resolves with the basic user information obtained from the ID token.
467
+ *
468
+ * @return {Promise<BasicUserInfo>} - A promise that resolves with the user information.
469
+ *
470
+ * @example
471
+ * ```
472
+ * auth.getBasicUserInfo().then((response) => {
473
+ * // console.log(response);
474
+ * }).catch((error) => {
475
+ * // console.error(error);
476
+ * });
477
+ * ```
478
+ *
479
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getuserinfo
480
+ *
481
+ * @memberof AsgardeoSPAClient
482
+ *
483
+ * @preserve
484
+ */
485
+
486
+ /**
487
+ * This method returns if the sign-out has failed or not.
488
+ *
489
+ * @param signOutRedirectUrl - The URL to which the user has been redirected to after signing-out.
490
+ *
491
+ * **The server appends path parameters to the `signOutRedirectURL` and these path parameters
492
+ * are required for this method to function.**
493
+ *
494
+ * @returns - `true` if successful, `false` otherwise.
495
+ *
496
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#didSignOutFail}
497
+ *
498
+ * @preserve
499
+ */
500
+
501
+ /**
502
+ * This method returns if the sign-out is successful or not.
503
+ *
504
+ * @param signOutRedirectUrl - The URL to which the user has been redirected to after signing-out.
505
+ *
506
+ * **The server appends path parameters to the `signOutRedirectURL` and these path parameters
507
+ * are required for this method to function.**
508
+ *
509
+ * @returns - `true` if successful, `false` otherwise.
510
+ *
511
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isSignOutSuccessful}
512
+ *
513
+ * @preserve
514
+ */
515
+
516
+ /**
517
+ * This method returns if the user is authenticated or not.
518
+ *
519
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
520
+ * scenarios where each user should be uniquely identified.
521
+ *
522
+ * @returns - A Promise that resolves with `true` if the user is authenticated, `false` otherwise.
523
+ *
524
+ * @example
525
+ * ```
526
+ * await auth.isAuthenticated();
527
+ * ```
528
+ *
529
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isAuthenticated}
530
+ *
531
+ * @preserve
532
+ */
533
+
534
+ /**
535
+ * This method returns the CryptoHelper instance.
536
+ *
537
+ * @return {Promise<DecodedIdTokenPayloadInterface>} - A Promise that resolves with
538
+ * the CryptoHelper instance.
539
+ *
540
+ * @example
541
+ * ```
542
+ * auth.getCryptoHelper().then((response)=>{
543
+ * // console.log(response);
544
+ * }).catch((error)=>{
545
+ * // console.error(error);
546
+ * });
547
+ * ```
548
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getCryptoHelper
549
+ *
550
+ * @memberof AsgardeoSPAClient
551
+ *
552
+ * @preserve
553
+ */
554
+
555
+ /**
556
+ * This method returns the ID token.
557
+ *
558
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
559
+ * scenarios where each user should be uniquely identified.
560
+ *
561
+ * @returns - A Promise that resolves with the ID token.
562
+ *
563
+ * @example
564
+ * ```
565
+ * const idToken = await auth.getIDToken();
566
+ * ```
567
+ *
568
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getIDToken}
569
+ *
570
+ * @preserve
571
+ */
572
+
573
+ /**
574
+ * This method returns the PKCE code generated during the generation of the authentication URL.
575
+ *
576
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
577
+ * scenarios where each user should be uniquely identified.
578
+ * @param state - The state parameter that was passed in the authentication URL.
579
+ *
580
+ * @returns - A Promise that resolves with the PKCE code.
581
+ *
582
+ * @example
583
+ * ```
584
+ * const pkce = await getPKCECode();
585
+ * ```
586
+ *
587
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getPKCECode}
588
+ *
589
+ * @preserve
590
+ */
591
+
592
+ /**
593
+ * This method returns the `DataLayer` object that allows you to access authentication data.
594
+ *
595
+ * @returns - The `DataLayer` object.
596
+ *
597
+ * @example
598
+ * ```
599
+ * const data = auth.getDataLayer();
600
+ * ```
601
+ *
602
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getDataLayer}
603
+ *
604
+ * @preserve
605
+ */
606
+
607
+ /**
608
+ * This method returns the `instanceID` variable of the given instance.
609
+ *
610
+ * @returns - The `instanceID` number.
611
+ *
612
+ * @example
613
+ * ```
614
+ * const instanceId = auth.getInstanceID();
615
+ * ```
616
+ *
617
+ * @preserve
618
+ */
619
+
620
+ /**
621
+ * This method returns the access token.
622
+ *
623
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
624
+ * scenarios where each user should be uniquely identified.
625
+ *
626
+ * @returns - A Promise that resolves with the access token.
627
+ *
628
+ * @example
629
+ * ```
630
+ * const accessToken = await auth.getAccessToken();
631
+ * ```
632
+ *
633
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getAccessToken}
634
+ *
635
+ * @preserve
636
+ */
637
+
638
+ /**
639
+ * This method returns the basic user information obtained from the ID token.
640
+ *
641
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
642
+ * scenarios where each user should be uniquely identified.
643
+ *
644
+ * @returns - A Promise that resolves with an object containing the basic user information.
645
+ *
646
+ * @example
647
+ * ```
648
+ * const userInfo = await auth.getBasicUserInfo();
649
+ * ```
650
+ *
651
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getBasicUserInfo}
652
+ *
653
+ * @preserve
654
+ */
655
+
656
+ /**
657
+ * This method returns the crypto helper object.
658
+ *
659
+ * @returns - A Promise that resolves with a CryptoHelper object.
660
+ *
661
+ * @example
662
+ * ```
663
+ * const cryptoHelper = await auth.CryptoHelper();
664
+ * ```
665
+ *
666
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getCryptoHelper}
667
+ *
668
+ * @preserve
669
+ */
670
+
671
+ /**
672
+ * This method returns the instance of the singleton class.
673
+ * If an ID is provided, it will return the instance with the given ID.
674
+ * If no ID is provided, it will return the default instance value 0.
675
+ *
676
+ * @return {AsgardeoSPAClient} - Returns the instance of the singleton class.
677
+ *
678
+ * @example
679
+ * ```
680
+ * const auth = AsgardeoSPAClient.getInstance();
681
+ * ```
682
+ *
683
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#getinstance
684
+ *
685
+ * @memberof AsgardeoSPAClient
686
+ *
687
+ * @preserve
688
+ */
689
+
690
+ /**
691
+ * This method returns the sign-out URL.
692
+ *
693
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
694
+ * scenarios where each user should be uniquely identified.
695
+ *
696
+ * **This doesn't clear the authentication data.**
697
+ *
698
+ * @returns - A Promise that resolves with the sign-out URL.
699
+ *
700
+ * @example
701
+ * ```
702
+ * const signOutUrl = await auth.getSignOutURL();
703
+ * ```
704
+ *
705
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getSignOutURL}
706
+ *
707
+ * @preserve
708
+ */
709
+
710
+ /**
711
+ * This method revokes the access token.
712
+ *
713
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
714
+ * scenarios where each user should be uniquely identified.
715
+ *
716
+ * **This method also clears the authentication data.**
717
+ *
718
+ * @returns - A Promise that returns the response of the revoke-access-token request.
719
+ *
720
+ * @example
721
+ * ```
722
+ * auth.revokeAccessToken().then((response)=>{
723
+ * // console.log(response);
724
+ * }).catch((error)=>{
725
+ * // console.error(error);
726
+ * });
727
+ * ```
728
+ *
729
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#revokeAccessToken}
730
+ *
731
+ * @preserve
732
+ */
733
+
734
+ /**
735
+ * This method sends a custom-grant request and returns a Promise that resolves with the response
736
+ * depending on the config passed.
737
+ *
738
+ * @param config - A config object containing the custom grant configurations.
739
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
740
+ * scenarios where each user should be uniquely identified.
741
+ *
742
+ * @returns - A Promise that resolves with the response depending
743
+ * on your configurations.
744
+ *
745
+ * @example
746
+ * ```
747
+ * const config = {
748
+ * attachToken: false,
749
+ * data: {
750
+ * client_id: "{{clientID}}",
751
+ * grant_type: "account_switch",
752
+ * scope: "{{scope}}",
753
+ * token: "{{token}}",
754
+ * },
755
+ * id: "account-switch",
756
+ * returnResponse: true,
757
+ * returnsSession: true,
758
+ * signInRequired: true
759
+ * }
760
+ *
761
+ * auth.requestCustomGrant(config).then((response)=>{
762
+ * // console.log(response);
763
+ * }).catch((error)=>{
764
+ * // console.error(error);
765
+ * });
766
+ * ```
767
+ *
768
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#requestCustomGrant}
769
+ *
770
+ * @preserve
771
+ */
772
+
773
+ /**
774
+ * This method sends an API request to a protected endpoint.
775
+ * The access token is automatically attached to the header of the request.
776
+ * This is the only way by which protected endpoints can be accessed
777
+ * when the web worker is used to store session information.
778
+ *
779
+ * @param {HttpRequestConfig} config - The config object containing attributes necessary to send a request.
780
+ *
781
+ * @return {Promise<HttpResponse>} - Returns a Promise that resolves with the response to the request.
782
+ *
783
+ * @example
784
+ * ```
785
+ * const requestConfig = {
786
+ * headers: {
787
+ * "Accept": "application/json",
788
+ * "Access-Control-Allow-Origin": "https://api.asgardeo.io/myaccount",
789
+ * "Content-Type": "application/scim+json"
790
+ * },
791
+ * method: "GET",
792
+ * url: "https://api.asgardeo.io/scim2/me"
793
+ * };
794
+ *
795
+ * return auth.httpRequest(requestConfig)
796
+ * .then((response) => {
797
+ * // console.log(response);
798
+ * })
799
+ * .catch((error) => {
800
+ * // console.error(error);
801
+ * });
802
+ * ```
803
+ *
804
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#httprequest
805
+ *
806
+ * @memberof AsgardeoSPAClient
807
+ *
808
+ * @preserve
809
+ */
810
+
811
+ /**
812
+ * This method sends multiple API requests to a protected endpoint.
813
+ * The access token is automatically attached to the header of the request.
814
+ * This is the only way by which multiple requests can be sent to protected endpoints
815
+ * when the web worker is used to store session information.
816
+ *
817
+ * @param {HttpRequestConfig[]} config - The config object containing attributes necessary to send a request.
818
+ *
819
+ * @return {Promise<HttpResponse[]>} - Returns a Promise that resolves with the responses to the requests.
820
+ *
821
+ * @example
822
+ * ```
823
+ * const requestConfig = {
824
+ * headers: {
825
+ * "Accept": "application/json",
826
+ * "Content-Type": "application/scim+json"
827
+ * },
828
+ * method: "GET",
829
+ * url: "https://api.asgardeo.io/scim2/me"
830
+ * };
831
+ *
832
+ * const requestConfig2 = {
833
+ * headers: {
834
+ * "Accept": "application/json",
835
+ * "Content-Type": "application/scim+json"
836
+ * },
837
+ * method: "GET",
838
+ * url: "https://api.asgardeo.io/scim2/me"
839
+ * };
840
+ *
841
+ * return auth.httpRequest([requestConfig, requestConfig2])
842
+ * .then((responses) => {
843
+ * response.forEach((response)=>{
844
+ * // console.log(response);
845
+ * });
846
+ * })
847
+ * .catch((error) => {
848
+ * // console.error(error);
849
+ * });
850
+ * ```
851
+ *
852
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master#httprequestall
853
+ *
854
+ * @memberof AsgardeoSPAClient
855
+ *
856
+ * @preserve
857
+ */
858
+
859
+ /**
860
+ * This method sets the PKCE code to the data store.
861
+ *
862
+ * @param pkce - The PKCE code.
863
+ * @param state - The state parameter that was passed in the authentication URL.
864
+ * @param userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
865
+ * scenarios where each user should be uniquely identified.
866
+ *
867
+ * @example
868
+ * ```
869
+ * await auth.setPKCECode("pkce_code")
870
+ * ```
871
+ *
872
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#setPKCECode}
873
+ *
874
+ * @preserve
875
+ */
876
+
877
+ /**
878
+ * This method specifies if the user is authenticated or not.
879
+ *
880
+ * @return {Promise<boolean>} - A Promise that resolves with `true` if the user is authenticated.
881
+ *
882
+ * @memberof AsgardeoSPAClient
883
+ *
884
+ * @preserve
885
+ */
886
+
887
+ /**
888
+ * This method specifies if there is an active session in the browser or not.
889
+ *
890
+ * @return {Promise<boolean>} - A Promise that resolves with `true` if there is a session.
891
+ *
892
+ * @memberof AsgardeoSPAClient
893
+ *
894
+ * @preserve
895
+ */
896
+
897
+ /**
898
+ * This method updates the configuration that was passed into the constructor when instantiating this class.
899
+ *
900
+ * @param config - A config object to update the SDK configurations with.
901
+ *
902
+ * @example
903
+ * ```
904
+ * const config = {
905
+ * signInRedirectURL: "http://localhost:3000/sign-in",
906
+ * clientID: "client ID",
907
+ * baseUrl: "https://localhost:9443"
908
+ * }
909
+ *
910
+ * await auth.updateConfig(config);
911
+ * ```
912
+ * {@link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#updateConfig}
913
+ *
914
+ * @preserve
915
+ */
916
+
917
+ /**
918
+ * This method updates the configuration that was passed into the constructor when instantiating this class.
919
+ *
920
+ * @param {Partial<AuthClientConfig<T>>} config - A config object to update the SDK configurations with.
921
+ *
922
+ * @example
923
+ * ```
924
+ * const config = {
925
+ * signInRedirectURL: "http://localhost:3000/sign-in",
926
+ * clientID: "client ID",
927
+ * baseUrl: "https://api.asgardeo.io"
928
+ * }
929
+ * const auth.updateConfig(config);
930
+ * ```
931
+ * @link https://github.com/asgardeo/asgardeo-auth-spa-sdk/tree/master/lib#updateConfig
932
+ *
933
+ * @memberof AsgardeoAuthClient
934
+ *
935
+ * @preserve
936
+ */
937
+
938
+ /**
939
+ * This methods returns the Axios http client.
940
+ *
941
+ * @return {HttpClientInstance} - The Axios HTTP client.
942
+ *
943
+ * @memberof AsgardeoSPAClient
944
+ *
945
+ * @preserve
946
+ */