Skip to content

Commit

Permalink
Merge branch 'MDL-70268-master-2' of git://github.com/peterRd/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Mar 3, 2021
2 parents a251c26 + 63cb899 commit 3cda34a
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions lib/oauthlib.php
Expand Up @@ -511,14 +511,22 @@ public function get_additional_login_parameters() {
public function get_login_url() {

$callbackurl = self::callback_url();
$defaultparams = [
'client_id' => $this->clientid,
'response_type' => 'code',
'redirect_uri' => $callbackurl->out(false),
'state' => $this->returnurl->out_as_local_url(false),

];
if (!empty($this->scope)) {
// The scope should only be included if a value is set.
// If none provided, the server MUST process the request and provide an appropriate documented response.
// See spec https://tools.ietf.org/html/rfc6749#section-3.3
$defaultparams['scope'] = $this->scope;
}

$params = array_merge(
[
'client_id' => $this->clientid,
'response_type' => 'code',
'redirect_uri' => $callbackurl->out(false),
'state' => $this->returnurl->out_as_local_url(false),
'scope' => $this->scope,
],
$defaultparams,
$this->get_additional_login_parameters()
);

Expand Down

0 comments on commit 3cda34a

Please sign in to comment.