Skip to content

Commit

Permalink
Update authsignal SDK request format
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisfisher committed Nov 25, 2024
1 parent 084fdfb commit 0d6e070
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
15 changes: 8 additions & 7 deletions lambdas/create-auth-challenge.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Authsignal } from "@authsignal/node";

const secret = process.env.AUTHSIGNAL_SECRET;
const apiBaseUrl = process.env.AUTHSIGNAL_URL;
const apiSecretKey = process.env.AUTHSIGNAL_SECRET;
const apiUrl = process.env.AUTHSIGNAL_URL;

const authsignal = new Authsignal({ secret, apiBaseUrl });
const authsignal = new Authsignal({ apiSecretKey, apiUrl });

export const handler = async (event) => {
const userId = event.request.userAttributes.sub;
Expand All @@ -22,11 +22,12 @@ export const handler = async (event) => {
}

const { url } = await authsignal.track({
action: "cognitoAuth",
userId,
email,
redirectUrl: "http://localhost:5173/callback",
redirectToSettings: false,
action: "cognitoAuth",
attributes: {
email,
redirectUrl: "http://localhost:5173/callback",
},
});

event.response.publicChallengeParameters = { url };
Expand Down
6 changes: 3 additions & 3 deletions lambdas/verify-auth-challenge-response.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Authsignal } from "@authsignal/node";

const secret = process.env.AUTHSIGNAL_SECRET;
const apiBaseUrl = process.env.AUTHSIGNAL_URL;
const apiSecretKey = process.env.AUTHSIGNAL_SECRET;
const apiUrl = process.env.AUTHSIGNAL_URL;

const authsignal = new Authsignal({ secret, apiBaseUrl });
const authsignal = new Authsignal({ apiSecretKey, apiUrl });

export const handler = async (event) => {
const userId = event.request.userAttributes.sub;
Expand Down

0 comments on commit 0d6e070

Please sign in to comment.