Skip to content

Commit

Permalink
add support for domain
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyapotti committed Sep 2, 2024
1 parent e2d1903 commit f9c2948
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/handlers/Web3AuthPasswordlessHandler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import deepmerge from "deepmerge";

import { decodeToken, loginToConnectionMap } from "../utils/helpers";
import { decodeToken, loginToConnectionMap, validateAndConstructUrl } from "../utils/helpers";
import AbstractLoginHandler from "./AbstractLoginHandler";
import { Auth0UserInfo, CreateHandlerParams, EMAIL_FLOW, LoginWindowResponse, TorusVerifierResponse } from "./interfaces";

Expand All @@ -17,8 +17,11 @@ export default class Web3AuthPasswordlessHandler extends AbstractLoginHandler {
}

setFinalUrl(): void {
const finalUrl = new URL("https://passwordless.web3auth.io/v6/authorize");
const { domain } = this.params.jwtParams || {};
const finalUrl = validateAndConstructUrl(domain || "https://passwordless.web3auth.io/v6");
finalUrl.pathname += finalUrl.pathname.endsWith("/") ? "authorize" : "/authorize";
const clonedParams = JSON.parse(JSON.stringify(this.params.jwtParams || {}));
delete clonedParams.domain;
this.params.customState = { ...(this.params.customState || {}), client: this.params.web3AuthClientId };
const finalJwtParams = deepmerge(
{
Expand Down

0 comments on commit f9c2948

Please sign in to comment.