Skip to content

Commit

Permalink
Merge branch 'MDL-61826-master' of git://github.com/junpataleta/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta authored and stronk7 committed Jun 6, 2018
2 parents 959d5fa + 7766dbe commit 054900f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions lib/classes/oauth2/api.php
Expand Up @@ -86,10 +86,24 @@ private static function create_facebook() {
$issuer = new issuer(0, $record);
$issuer->create();

// The Facebook API version.
$apiversion = '2.12';
// The Graph API URL.
$graphurl = 'https://graph.facebook.com/v' . $apiversion;
// User information fields that we want to fetch.
$infofields = [
'id',
'first_name',
'last_name',
'link',
'picture.type(large)',
'name',
'email',
];
$endpoints = [
'authorization_endpoint' => 'https://www.facebook.com/v2.12/dialog/oauth',
'token_endpoint' => 'https://graph.facebook.com/v2.12/oauth/access_token',
'userinfo_endpoint' => 'https://graph.facebook.com/v2.12/me?fields=id,first_name,last_name,link,picture,name,email'
'authorization_endpoint' => sprintf('https://www.facebook.com/v%s/dialog/oauth', $apiversion),
'token_endpoint' => $graphurl . '/oauth/access_token',
'userinfo_endpoint' => $graphurl . '/me?fields=' . implode(',', $infofields)
];

foreach ($endpoints as $name => $url) {
Expand Down

0 comments on commit 054900f

Please sign in to comment.