Skip to content

Commit

Permalink
Allow passing base url to auth0 helper (#15)
Browse files Browse the repository at this point in the history
* Allow passing base url to auth0 helper

* wip
  • Loading branch information
chrisfisher authored Mar 13, 2023
1 parent 991cfbd commit e67e48e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@authsignal/node",
"version": "0.0.36",
"version": "0.0.37",
"types": "dist/index.d.ts",
"keywords": [
"authsignal",
Expand Down
8 changes: 6 additions & 2 deletions src/integrations/auth0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface ExecutePostLoginOptions {
action?: string;
redirectUrl?: string;
custom?: object;
apiBaseUrl?: string;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -25,9 +26,10 @@ export async function handleAuth0ExecutePostLogin(event: any, api: any, options:
action = DEFAULT_ACTION_NAME,
redirectUrl = `https://${event.request.hostname}/continue`,
custom = {},
apiBaseUrl,
} = options ?? {};

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

const result = await authsignal.track({
action,
Expand All @@ -53,6 +55,7 @@ export interface ContinuePostLoginOptions {
userId?: string;
action?: string;
failureMessage?: string;
apiBaseUrl?: string;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -62,11 +65,12 @@ export async function handleAuth0ContinuePostLogin(event: any, api: any, options
userId = event.user.user_id,
action = DEFAULT_ACTION_NAME,
failureMessage = "MFA challenge failed",
apiBaseUrl,
} = options ?? {};

const payload = api.redirect.validateToken({secret, tokenParameterName: "token"});

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

const actionResult = await authsignal.getAction({
action,
Expand Down

0 comments on commit e67e48e

Please sign in to comment.