fix(auth): correctly construct redirect url from current window href
This commit is contained in:
parent
a8df935ddb
commit
67216579bc
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user