1
0

Directly redirect to the openid auth provider if that's the only auth method

This commit is contained in:
kolaente
2021-08-15 12:02:29 +02:00
parent a5687d78f5
commit 3aa316988b
5 changed files with 49 additions and 16 deletions

View File

@ -0,0 +1,13 @@
interface Provider {
name: string
key: string
authUrl: string
clientId: string
}
export const redirectToProvider = (provider: Provider, redirectUrl: string) => {
const state = Math.random().toString(36).substring(2, 24)
localStorage.setItem('state', state)
window.location.href = `${provider.authUrl}?client_id=${provider.clientId}&redirect_uri=${redirectUrl}${provider.key}&response_type=code&scope=openid email profile&state=${state}`
}