diff --git a/src/helpers/redirectToProvider.ts b/src/helpers/redirectToProvider.ts index 2df546d51a..efd1f622f4 100644 --- a/src/helpers/redirectToProvider.ts +++ b/src/helpers/redirectToProvider.ts @@ -1,11 +1,13 @@ import {createRandomID} from '@/helpers/randomId' import type {IProvider} from '@/types/IProvider' +import {parseURL} from 'ufo' export const redirectToProvider = (provider: IProvider) => { // We're not using the redirect url provided by the server to allow redirects when using the electron app. // The implications are not quite clear yet hence the logic to pass in another redirect url still exists. - const redirectUrl = `${window.location.href.replace('/login', '')}/auth/openid/` + const url = parseURL(window.location.href) + const redirectUrl = `${url.protocol}//${url.host}/auth/openid/` const state = createRandomID(24) localStorage.setItem('state', state)