diff --git a/assets/js/loginform_helpers.js b/assets/js/loginform_helpers.js index 2f6fdab..956472d 100644 --- a/assets/js/loginform_helpers.js +++ b/assets/js/loginform_helpers.js @@ -75,5 +75,16 @@ jQuery(document).ready(function($) { window.location.href = appended_href; }); + // if pmsso exists, just add the pkce code challenge etc and redirect them + if ($(".passport-login-wrap li.pmsso a")) { + console.log('setting verifier'); + var code_verifier = generateRandomString(); + document.cookie='pkce_code_verifier=' + code_verifier + ';domain=' + window.location.hostname + ';path=/'; + var code_challenge = await pkceChallengeFromVerifier(code_verifier); + var encoded_code_challenge = encodeURIComponent(code_challenge); + appended_href = $(this).attr('href') + "&code_challenge=" + encoded_code_challenge + "&code_challenge_method=S256"; + window.location.href = appended_href; + } + });