login page

This commit is contained in:
Jan Prochazka
2022-11-25 13:36:18 +01:00
parent 07b2a3e923
commit 70413b954b
6 changed files with 153 additions and 10 deletions

View File

@@ -19,7 +19,7 @@ export function handleOauthCallback() {
sessionStorage.removeItem('oauthState');
apiCall('auth/oauth-token', {
code: sentCode,
redirectUri: location.origin,
redirectUri: location.origin + location.pathname,
}).then(authResp => {
const { accessToken } = authResp;
localStorage.setItem('accessToken', accessToken);
@@ -50,7 +50,7 @@ export async function redirectToLogin(config = null) {
console.log('Redirecting to OAUTH provider');
location.replace(
`${config.oauth}?client_id=dbgate&response_type=code&redirect_uri=${encodeURIComponent(
location.origin
location.origin + location.pathname
)}&state=${encodeURIComponent(state)}`
);
}