Skip to content

Commit 446cbb6

Browse files
committed
fix: create JWT token from current logged in user
1 parent 3b8b7ca commit 446cbb6

File tree

1 file changed

+3
-8
lines changed
  • src/auth/identity_auth_login_done

1 file changed

+3
-8
lines changed

src/auth/identity_auth_login_done/index.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
11
const { response } = require("../../utils");
22
const jwt = require("jsonwebtoken");
33
const SWA_EMU_AUTH_URI = process.env.SWA_EMU_AUTH_URI || `http://localhost:4242`;
4+
const { currentUser } = require("../../userManager");
45

56
const jwtKey = "123";
67
const jwtExpirySeconds = 300;
78

89
module.exports = async function (context, req) {
10+
const { cookie } = req.headers;
911
const payload = {
10-
...{
11-
identityprovider: "github",
12-
useridfromprovider: "1699357",
13-
userid: "59cd31faa8c34919ac22c19af50482b8",
14-
userdetails: "manekinekko",
15-
isnewuser: "False",
16-
existingroles: "",
17-
},
12+
...currentUser(cookie),
1813
nonce: context.invocationId,
1914
iss: "localhost",
2015
aud: "localhost",

0 commit comments

Comments
 (0)