@asgardeo/express 0.0.29 → 0.0.31
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 +1 -47
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,52 +21,6 @@ pnpm add @asgardeo/express
|
|
|
21
21
|
yarn add @asgardeo/express
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
-
## Quick Start
|
|
25
|
-
|
|
26
|
-
```javascript
|
|
27
|
-
import { AsgardeoExpressClient } from "@asgardeo/express";
|
|
28
|
-
|
|
29
|
-
// Initialize the client
|
|
30
|
-
const authClient = new AsgardeoExpressClient({
|
|
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
|
-
```
|
|
69
|
-
|
|
70
24
|
## License
|
|
71
25
|
|
|
72
|
-
Apache
|
|
26
|
+
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/express",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"description": "Express.js implementation of Asgardeo JavaScript SDK.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"asgardeo",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"uuid": "11.1.0",
|
|
49
|
-
"@asgardeo/node": "0.0.
|
|
49
|
+
"@asgardeo/node": "0.0.32"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"express": "4.21.2"
|