.
This commit is contained in:
parent
9c701a9bb1
commit
c722fa701c
1 changed files with 8 additions and 2 deletions
10
client.ts
10
client.ts
|
|
@ -10,7 +10,8 @@ dotenv.config({ quiet: true });
|
|||
|
||||
const AUTH_CLIENT_PORT = Number(process.env.AUTH_CLIENT_PORT) || 3002;
|
||||
const CLIENT_URL = String(process.env.CLIENT_URL) || "http://localhost";
|
||||
const AUTHENTICATED_URL = String(process.env.AUTHENTICATED_URL) || "http://localhost";
|
||||
const AUTHENTICATED_URL =
|
||||
String(process.env.AUTHENTICATED_URL) || "http://localhost";
|
||||
const CLIENT_SECRET = String(process.env.CLIENT_SECRET);
|
||||
assert(CLIENT_SECRET.length > 0);
|
||||
|
||||
|
|
@ -86,12 +87,17 @@ app.get("/callback/:cbid", async (req, res) => {
|
|||
|
||||
app.use(cookieParser());
|
||||
|
||||
app.get("/noauth", (req, res) => {
|
||||
res.status(200);
|
||||
res.end();
|
||||
});
|
||||
|
||||
app.get("/authorize", (req, res) => {
|
||||
try {
|
||||
const { tokens, claims } = jwt.verify(
|
||||
req.cookies.auth_cookie,
|
||||
CLIENT_SECRET,
|
||||
) as JwtPayload;
|
||||
) as JwtPayload;
|
||||
console.log(`Authorized '${claims.sub}' from ${claims.iss}`);
|
||||
res.setHeader("AuthSub", claims.sub);
|
||||
res.setHeader("AuthIssuer", claims.iss);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue