diff --git a/classes/loginflow/authcode.php b/classes/loginflow/authcode.php index 3e8f212..2404e77 100644 --- a/classes/loginflow/authcode.php +++ b/classes/loginflow/authcode.php @@ -72,12 +72,18 @@ public function loginpage_idp_list($wantsurl) { public function handleredirect() { $state = optional_param('state', '', PARAM_RAW); $promptlogin = (bool)optional_param('promptlogin', 0, PARAM_BOOL); + $promptaconsent = (bool)optional_param('promptaconsent', 0, PARAM_BOOL); if (!empty($state)) { // Response from OP. $this->handleauthresponse($_REQUEST); } else { // Initial login request. - $this->initiateauthrequest($promptlogin, ['forceflow' => 'authcode']); + $stateparams = ['forceflow' => 'authcode']; + $extraparams = []; + if ($promptaconsent === true) { + $extraparams = ['prompt' => 'admin_consent']; + } + $this->initiateauthrequest($promptlogin, $stateparams, $extraparams); } }