mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 14:02:32 +02:00
MDL-61826 auth: Make Facebook endpoints more maintainable
This commit is contained in:
parent
ac45c16544
commit
7766dbed5d
@ -86,10 +86,24 @@ class api {
|
||||
$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.type(large),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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user