diff --git a/src/authentication/connector.ts b/src/authentication/connector.ts index 640f6c47..2c7a12e5 100644 --- a/src/authentication/connector.ts +++ b/src/authentication/connector.ts @@ -167,6 +167,28 @@ async function authorizationCodeCallback(config: DefaultClientConfiguration, cod return atoken; } +async function refreshAuth(extraParams: Record) { + const config = getConfig(); + const auth = { + ...config + }; + const req = jso_getAuthRequest(auth.provider, auth.scope); + console.log(config.redirect_uri); + let pkce: PKCERequest; + pkce = await generatePKCE(); + + req["code_challenge"] = pkce.codeChallenge; + req["code_challenge_method"] = "S256"; + delete req.prompt + delete req.response_mode + + if (window.top) { + const authUrl = encodeURL(auth.authorization, {...req, ...extraParams}); + + window.top.location.href = authUrl + } +} + function logInWithRedirect(reset: boolean = false, extraParams?: Record) { console.log("In redirect..."); return new Promise(async (resolve, reject) => { @@ -236,7 +258,7 @@ function logInWithRedirect(reset: boolean = false, extraParams?: Record