Skip to content

Commit

Permalink
Added secret and associated processing to prevent bypass of LinkedIn …
Browse files Browse the repository at this point in the history
…logon
  • Loading branch information
Jon committed Jul 7, 2024
2 parents 093017b + 80d3b76 commit 0d27146
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions api/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
const axios = require('axios');
const qs = require('qs');

async function redirectWithEmail (code, session, conversation, context, res) {
async function redirectWithEmail (code, session, conversation, secret, context, res) {

try {

Expand Down Expand Up @@ -46,7 +46,8 @@ async function redirectWithEmail (code, session, conversation, context, res) {
var redirect = "/aibot.html#&session=" + session +
"&conversation=" + conversation +
"&email=" + encodeURIComponent(profileRes.data.email) +
"&name=" + encodeURIComponent(profileRes.data.name);
"&name=" + encodeURIComponent(profileRes.data.name) +
"&secret=" + encodeURIComponent(secret);

if (res) {
res.redirect (redirect);
Expand Down Expand Up @@ -84,7 +85,7 @@ module.exports = async function (context, req, res) {
if ((parsed.session.startsWith (process.env.SessionKey)) || (parsed.session.startsWith (process.env.SessionKey2))
&& req.query.code) {

await redirectWithEmail (req.query.code, parsed.session, parsed.conversation, context, res);
await redirectWithEmail (req.query.code, parsed.session, parsed.conversation, parsed.secret, context, res);
} else {
if (res) {
res = {
Expand Down
2 changes: 1 addition & 1 deletion public/assets/js/aibot.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion public/assets/js/aibot.min.js.map

Large diffs are not rendered by default.

0 comments on commit 0d27146

Please sign in to comment.