@asgardeo/node 0.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,72 @@
1
+ <p align="center" style="color: #343a40">
2
+ <h1 align="center">@asgardeo/node</h1>
3
+ </p>
4
+ <p align="center" style="font-size: 1.2rem;">Node.js SDK for Asgardeo</p>
5
+ <div align="center">
6
+ <img alt="npm (scoped)" src="https://img.shields.io/npm/v/@asgardeo/node">
7
+ <img alt="npm" src="https://img.shields.io/npm/dw/@asgardeo/node">
8
+ <a href="./LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"></a>
9
+ </div>
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ # Using npm
15
+ npm install @asgardeo/node
16
+
17
+ # or using pnpm
18
+ pnpm add @asgardeo/node
19
+
20
+ # or using yarn
21
+ yarn add @asgardeo/node
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```javascript
27
+ import { AsgardeoNodeClient } from "@asgardeo/node";
28
+
29
+ // Initialize the client
30
+ const authClient = new AsgardeoNodeClient({
31
+ clientID: "<your_client_id>",
32
+ clientSecret: "<your_client_secret>",
33
+ baseUrl: "https://api.asgardeo.io/t/<org_name>",
34
+ callbackURL: "http://localhost:3000/callback"
35
+ });
36
+
37
+ // Example Express.js integration
38
+ import express from "express";
39
+ const app = express();
40
+
41
+ // Login endpoint
42
+ app.get("/login", (req, res) => {
43
+ const authUrl = authClient.getAuthorizationURL();
44
+ res.redirect(authUrl);
45
+ });
46
+
47
+ // Callback handler
48
+ app.get("/callback", async (req, res) => {
49
+ try {
50
+ const { code } = req.query;
51
+ const tokens = await authClient.exchangeAuthorizationCode(code);
52
+ // Store tokens and redirect to home page
53
+ res.redirect("/");
54
+ } catch (error) {
55
+ res.status(500).send("Authentication failed");
56
+ }
57
+ });
58
+
59
+ // Get user info
60
+ app.get("/userinfo", async (req, res) => {
61
+ try {
62
+ const userInfo = await authClient.getUserInfo();
63
+ res.json(userInfo);
64
+ } catch (error) {
65
+ res.status(401).send("Unauthorized");
66
+ }
67
+ });
68
+ ```
69
+
70
+ ## License
71
+
72
+ Apache-2.0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
3
+ *
4
+ * WSO2 LLC. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { AsgardeoJavaScriptClient } from '@asgardeo/javascript';
19
+ import { AsgardeoNodeConfig } from './models/config';
20
+ /**
21
+ * Base class for implementing Asgardeo in Node.js based applications.
22
+ * This class provides the core functionality for managing user authentication and sessions.
23
+ *
24
+ * @typeParam T - Configuration type that extends AsgardeoNodeConfig.
25
+ */
26
+ declare abstract class AsgardeoNodeClient<T = AsgardeoNodeConfig> extends AsgardeoJavaScriptClient<T> {
27
+ }
28
+ export default AsgardeoNodeClient;
@@ -0,0 +1,346 @@
1
+ /**
2
+ * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
3
+ *
4
+ * WSO2 Inc. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ import { AuthClientConfig, BasicUserInfo, CustomGrantConfig, DataLayer, IdTokenPayload, FetchResponse, OIDCEndpoints, Store, TokenResponse } from '@asgardeo/javascript';
19
+ import { AuthURLCallback } from './models';
20
+ /**
21
+ * This class provides the necessary methods needed to implement authentication.
22
+ *
23
+ * @export
24
+ * @class AsgardeoNodeClient
25
+ */
26
+ export declare class AsgardeoNodeClient<T> {
27
+ private _authCore;
28
+ /**
29
+ * This is the constructor method that returns an instance of the `AsgardeoNodeClient` class.
30
+ *
31
+ * @param {AuthClientConfig<T>} config - The configuration object.
32
+ * @param {Store} store - The store object.
33
+ *
34
+ * @example
35
+ * ```
36
+ * const _store: Store = new DataStore();
37
+ * const _config = {
38
+ signInRedirectURL: "http://localhost:3000/sign-in",
39
+ signOutRedirectURL: "http://localhost:3000/dashboard",
40
+ clientID: "client ID",
41
+ serverOrigin: "https://api.asgardeo.io/t/<org_name>"
42
+ };
43
+ * const auth = new AsgardeoNodeClient(_config,_store);
44
+ * ```
45
+ *
46
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#constructor
47
+ * @preserve
48
+ */
49
+ constructor();
50
+ initialize(config: AuthClientConfig<T>, store?: Store): Promise<boolean>;
51
+ /**
52
+ * This method logs in a user. If the authorization code is not available it will resolve with the
53
+ * authorization URL to authorize the user.
54
+ * @param {string} authorizationCode - The authorization code obtained from Asgardeo after a user signs in.
55
+ * @param {String} sessionState - The session state obtained from Asgardeo after a user signs in.
56
+ * @param {string} userID - (Optional) A unique ID of the user to be authenticated. This is useful in multi-user
57
+ * scenarios where each user should be uniquely identified.
58
+ * @param {string} state - The state parameter in the redirect URL.
59
+ *
60
+ * @return {Promise<URLResponse | NodeTokenResponse>} - A Promise that resolves with the
61
+ * [`URLResponse`](#URLResponse) object or a Promise that resolves with
62
+ * the [`NodeTokenResponse`](#NodeTokenResponse) object.
63
+ *
64
+ * @example
65
+ * ```
66
+ * authClient.signIn(req.query.code, req.query.session_state).then(response => {
67
+ * //URL property will available if the user has not been authenticated already
68
+ * if (response.hasOwnProperty('url')) {
69
+ * res.redirect(response.url)
70
+ * } else {
71
+ * //Set the cookie
72
+ * res.cookie('ASGARDEO_SESSION_ID', response.session, { maxAge: 900000, httpOnly: true, SameSite: true });
73
+ * res.status(200).send(response)
74
+ * }
75
+ *});
76
+ * ```
77
+ *
78
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#signIn
79
+ *
80
+ * @memberof AsgardeoNodeClient
81
+ *
82
+ */
83
+ signIn(authURLCallback: AuthURLCallback, userId: string, authorizationCode?: string, sessionState?: string, state?: string, signInConfig?: Record<string, string | boolean>): Promise<TokenResponse>;
84
+ /**
85
+ * This method clears all session data and returns the sign-out URL.
86
+ * @param {string} userId - The userId of the user. (If you are using ExpressJS,
87
+ * you may get this from the request cookies)
88
+ *
89
+ * @return {Promise<string>} - A Promise that resolves with the sign-out URL.
90
+ *
91
+ * @example
92
+ * ```
93
+ * const signOutUrl = await auth.signOut(userId);
94
+ * ```
95
+ *
96
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#signOut
97
+ *
98
+ * @memberof AsgardeoNodeClient
99
+ *
100
+ */
101
+ signOut(userId: string): Promise<string>;
102
+ /**
103
+ * This method returns a boolean value indicating if the user is authenticated or not.
104
+ * @param {string} userId - The userId of the user.
105
+ * (If you are using ExpressJS, you may get this from the request cookies)
106
+ *
107
+ * @return { Promise<boolean>} -A boolean value that indicates of the user is authenticated or not.
108
+ *
109
+ * @example
110
+ * ```
111
+ * const isAuth = await authClient.isAuthenticated("a2a2972c-51cd-5e9d-a9ae-058fae9f7927");
112
+ * ```
113
+ *
114
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isAuthenticated
115
+ *
116
+ * @memberof AsgardeoNodeClient
117
+ *
118
+ */
119
+ isAuthenticated(userId: string): Promise<boolean>;
120
+ /**
121
+ * This method returns the id token.
122
+ * @param {string} userId - The userId of the user.
123
+ * (If you are using ExpressJS, you may get this from the request cookies)
124
+ *
125
+ * @return {Promise<string>} -A Promise that resolves with the ID Token.
126
+ *
127
+ * @example
128
+ * ```
129
+ * const isAuth = await authClient.getIDToken("a2a2972c-51cd-5e9d-a9ae-058fae9f7927");
130
+ * ```
131
+ *
132
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getIDToken
133
+ *
134
+ * @memberof AsgardeoNodeClient
135
+ *
136
+ */
137
+ getIDToken(userId: string): Promise<string>;
138
+ /**
139
+ * This method returns an object containing basic user information obtained from the id token.
140
+ * @param {string} userId - The userId of the user.
141
+ * (If you are using ExpressJS, you may get this from the request cookies)
142
+ *
143
+ * @return {Promise<string>} -A Promise that resolves with the
144
+ * An object containing basic user information obtained from the id token.
145
+ *
146
+ * @example
147
+ * ```
148
+ * const basicInfo = await authClient.getBasicUserInfo("a2a2972c-51cd-5e9d-a9ae-058fae9f7927");
149
+ * ```
150
+ *
151
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getBasicUserInfo
152
+ *
153
+ * @memberof AsgardeoNodeClient
154
+ *
155
+ */
156
+ getBasicUserInfo(userId: string): Promise<BasicUserInfo>;
157
+ /**
158
+ * This method returns an object containing the OIDC service endpoints returned by the `.well-known` endpoint.
159
+ * @return {Promise<OIDCEndpoints>} -A Promise that resolves with
160
+ * an object containing the OIDC service endpoints returned by the `.well-known` endpoint.
161
+ *
162
+ * @example
163
+ * ```
164
+ * const oidcEndpoints = await auth.getOIDCServiceEndpoints();
165
+ * ```
166
+ *
167
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getOIDCServiceEndpoints
168
+ *
169
+ * @memberof AsgardeoNodeClient
170
+ *
171
+ */
172
+ getOIDCServiceEndpoints(): Promise<OIDCEndpoints>;
173
+ /**
174
+ * This method returns the decoded ID token payload.
175
+ * @param {string} userId - The userId of the user.
176
+ * (If you are using ExpressJS, you may get this from the request cookies)
177
+ *
178
+ * @return {Promise<IdTokenPayload>} -A Promise that resolves with
179
+ * an object containing the decoded ID token payload.
180
+ *
181
+ * @example
182
+ * ```
183
+ * const decodedIDTokenPayload = await auth.getDecodedIDToken("a2a2972c-51cd-5e9d-a9ae-058fae9f7927");
184
+ * ```
185
+ *
186
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getDecodedIDToken
187
+ *
188
+ * @memberof AsgardeoNodeClient
189
+ *
190
+ */
191
+ getDecodedIDToken(userId?: string): Promise<IdTokenPayload>;
192
+ /**
193
+ * This method returns the access token.
194
+ * @param {string} userId - The userId of the user.
195
+ * (If you are using ExpressJS, you may get this from the request cookies)
196
+ *
197
+ * @return {Promise<string>} -A Promise that resolves with
198
+ * the access token stored in the store
199
+ *
200
+ * @example
201
+ * ```
202
+ *const accessToken = await auth.getAccessToken("a2a2972c-51cd-5e9d-a9ae-058fae9f7927");
203
+ * ```
204
+ *
205
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#getAccessToken
206
+ *
207
+ * @memberof AsgardeoNodeClient
208
+ *
209
+ */
210
+ getAccessToken(userId?: string): Promise<string>;
211
+ /**
212
+ * This method returns Promise that resolves with the token information
213
+ * or the response returned by the server depending on the configuration passed.
214
+ * @param {CustomGrantConfig} config - The config object contains attributes that would be used
215
+ * to configure the custom grant request.
216
+ *
217
+ * @param {string} userId - The userId of the user.
218
+ * (If you are using ExpressJS, you may get this from the request cookies)
219
+ *
220
+ * @return {Promise<TokenResponse | FetchResponse>} -A Promise that resolves with the token information
221
+ * or the response returned by the server depending on the configuration passed.
222
+ *
223
+ * @example
224
+ * ```
225
+ * const config = {
226
+ * attachToken: false,
227
+ * data: {
228
+ * client_id: "{{clientID}}",
229
+ * grant_type: "account_switch",
230
+ * scope: "{{scope}}",
231
+ * token: "{{token}}",
232
+ * },
233
+ * id: "account-switch",
234
+ * returnResponse: true,
235
+ * returnsSession: true,
236
+ * signInRequired: true
237
+ * }
238
+
239
+ * auth.requestCustomGrant(config).then((response)=>{
240
+ * console.log(response);
241
+ * }).catch((error)=>{
242
+ * console.error(error);
243
+ * });
244
+ * ```
245
+ *
246
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#requestCustomGrant
247
+ *
248
+ * @memberof AsgardeoNodeClient
249
+ *
250
+ */
251
+ requestCustomGrant(config: CustomGrantConfig, userId?: string): Promise<TokenResponse | FetchResponse>;
252
+ /**
253
+ * This method can be used to update the configurations passed into the constructor of the AsgardeoAuthClient.
254
+ * @param {AuthClientConfig<T>} config - The config object containing the attributes
255
+ * that can be used to configure the SDK
256
+ *
257
+ * @return {Promise<void>} -A Promise that resolves with a void.
258
+ *
259
+ * @example
260
+ * ```
261
+ * const updateConfig = await auth.updateConfig({
262
+ * signOutRedirectURL: "http://localhost:3000/sign-out"
263
+ * });
264
+ * ```
265
+ *
266
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#updateConfig
267
+ *
268
+ * @memberof AsgardeoNodeClient
269
+ *
270
+ */
271
+ updateConfig(config: Partial<AuthClientConfig<T>>): Promise<void>;
272
+ /**
273
+ * This method returns a Promise that resolves with the response returned by the server.
274
+ * @param {string} userId - The userId of the user.
275
+ * (If you are using ExpressJS, you may get this from the request cookies)
276
+ *
277
+ * @return {Promise<FetchResponse>} -A Promise that resolves with the response returned by the server.
278
+ *
279
+ * @example
280
+ * ```
281
+ * const revokeToken = await auth.revokeAccessToken("a2a2972c-51cd-5e9d-a9ae-058fae9f7927");
282
+ * ```
283
+ *
284
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#revokeAccessToken
285
+ *
286
+ * @memberof AsgardeoNodeClient
287
+ *
288
+ */
289
+ revokeAccessToken(userId?: string): Promise<FetchResponse>;
290
+ /**
291
+ * This method refreshes the access token and returns a Promise that resolves with the new access
292
+ * token and other relevant data.
293
+ *
294
+ * @param {string} userId - A unique ID of the user to be authenticated. This is useful in multi-user
295
+ * scenarios where each user should be uniquely identified.
296
+ *
297
+ * @returns {Promise<TokenResponse>} - A Promise that resolves with the token response.
298
+ *
299
+ * @example
300
+ * ```
301
+ * const tokenResponse = await auth.refreshAccessToken("a2a2972c-51cd-5e9d-a9ae-058fae9f7927")
302
+ * ```
303
+ *
304
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#refreshAccessToken
305
+ *
306
+ * @memberof AsgardeoNodeClient
307
+ */
308
+ refreshAccessToken(userId?: string): Promise<TokenResponse>;
309
+ /**
310
+ * This method returns if the user has been successfully signed out or not.
311
+ * @param {string} signOutRedirectURL - The URL to which the user is redirected to
312
+ * after signing out from the server.
313
+ *
314
+ * @return {boolean} - A boolean value indicating if the user has been signed out or not.
315
+ *
316
+ * @example
317
+ * ```
318
+ * const isSignedOut = auth.isSignOutSuccessful(<signout_url>);;
319
+ * ```
320
+ *
321
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#isSignOutSuccessful
322
+ *
323
+ * @memberof AsgardeoNodeClient
324
+ *
325
+ */
326
+ static isSignOutSuccessful(signOutRedirectURL: string): boolean;
327
+ /**
328
+ * This method returns if sign-out failed or not
329
+ * @param {string} signOutRedirectURL - The URL to which the user is redirected to
330
+ * after signing out from the server.
331
+ *
332
+ * @return {boolean} - A boolean value indicating if sign-out failed or not.
333
+ *
334
+ * @example
335
+ * ```
336
+ * const isSignedOut = auth.isSignOutSuccessful(<signout_url>);
337
+ * ```
338
+ *
339
+ * @link https://github.com/asgardeo/asgardeo-auth-js-sdk/tree/master#didSignOutFail
340
+ *
341
+ * @memberof AsgardeoNodeClient
342
+ *
343
+ */
344
+ static didSignOutFail(signOutRedirectURL: string): boolean;
345
+ getDataLayer(): Promise<DataLayer<T>>;
346
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright (c) 2022, WSO2 Inc. (http://www.wso2.com) All Rights Reserved.
3
+ *
4
+ * WSO2 Inc. licenses this file to you under the Apache License,
5
+ * Version 2.0 (the "License"); you may not use this file except
6
+ * in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing,
12
+ * software distributed under the License is distributed on an
13
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
+ * KIND, either express or implied. See the License for the
15
+ * specific language governing permissions and limitations
16
+ * under the License.
17
+ */
18
+ export * from "./uuid-config";
19
+ export * from "./logger-config";