Skip to content

Commit

Permalink
fix: don't start login flow if user is not in browser
Browse files Browse the repository at this point in the history
  • Loading branch information
bompo committed Nov 6, 2024
1 parent 10dcb06 commit 13286e2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/LoginWithAuth0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ export const loginWithAuth0 = async (
instanceUrl: string,
forceAuthLogin: boolean = false,
): Promise<string | null> => {
if (typeof window === "undefined") {
throw new Error(
"Window object is not available. Cannot perform login flow.",
)
}

if (!forceAuthLogin) {
if (!isLoginRequired(instanceUrl) || isDeployedOnPortalInstance()) {
console.log("Login not required for this instance.")
Expand Down

0 comments on commit 13286e2

Please sign in to comment.