@asgardeo/node 0.0.31 → 0.0.33
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/README.md +5 -59
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,65 +8,11 @@
|
|
|
8
8
|
<a href="./LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"></a>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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.getSignInUrl();
|
|
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
|
-
```
|
|
11
|
+
> [!IMPORTANT]
|
|
12
|
+
> ⚠️ Do not directly use this in your applications.
|
|
13
|
+
> `@asgardeo/node` is a framework agnostic SDK that provides core authentication functionalities.
|
|
14
|
+
> For framework-specific integrations, consider using the dedicated SDKs such as `@asgardeo/express`, etc.
|
|
69
15
|
|
|
70
16
|
## License
|
|
71
17
|
|
|
72
|
-
Apache
|
|
18
|
+
Licenses this source under the Apache License, Version 2.0 [LICENSE](./LICENSE), You may not use this file except in compliance with the License.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asgardeo/node",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.33",
|
|
4
4
|
"description": "Node.js runtime specific implementation of Asgardeo JavaScript SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"asgardeo",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"secure-random-bytes": "5.0.1",
|
|
53
53
|
"tslib": "2.8.1",
|
|
54
54
|
"uuid": "11.1.0",
|
|
55
|
-
"@asgardeo/javascript": "0.2.
|
|
55
|
+
"@asgardeo/javascript": "0.2.7"
|
|
56
56
|
},
|
|
57
57
|
"publishConfig": {
|
|
58
58
|
"access": "public"
|