function oauthconnector_presets in OAuth Connector 7
2 calls to oauthconnector_presets()
- oauthconnector_add_provider in ./
oauthconnector.admin.inc - Handle the add provider page.
- oauthconnector_presets_form in ./
oauthconnector.admin.inc
File
- ./
oauthconnector.admin.inc, line 618 - Administrative functions for the OAuth Connector module.
Code
function oauthconnector_presets() {
$twitter = new stdClass();
$twitter->name = '';
$twitter->title = 'Twitter';
$twitter->url = 'https://api.twitter.com';
$twitter->consumer_advanced = array(
'oauth2' => 0,
'signature method' => 'HMAC-SHA1',
'authentication realm' => '',
'request token endpoint' => '/oauth/request_token',
'authorization scope' => '',
'authorization endpoint' => '/oauth/authorize',
'access token endpoint' => '/oauth/access_token',
);
$twitter->mapping = array(
'fields' => array(
'uid' => array(
'resource' => 'https://api.twitter.com/1.1/account/verify_credentials.json',
'method post' => 0,
'field' => 'id',
'querypath' => 0,
),
'name' => array(
'resource' => 'https://api.twitter.com/1.1/account/verify_credentials.json',
'method post' => 0,
'field' => 'name',
'querypath' => 0,
),
'avatar' => array(
'resource' => 'https://api.twitter.com/1.1/account/verify_credentials.json',
'method post' => 0,
'field' => 'profile_image_url',
'querypath' => 0,
),
),
'format' => 'json',
);
$linkedin = new stdClass();
$linkedin->name = '';
$linkedin->title = 'LinkedIn';
$linkedin->url = 'https://api.linkedin.com';
$linkedin->consumer_advanced = array(
'oauth2' => 0,
'signature method' => 'HMAC-SHA1',
'authentication realm' => '',
'request token endpoint' => '/uas/oauth/requestToken',
'authorization scope' => '',
'authorization endpoint' => '/uas/oauth/authenticate',
'access token endpoint' => '/uas/oauth/accessToken',
);
$linkedin->mapping = array(
'fields' => array(
'uid' => array(
'resource' => 'https://api.linkedin.com/v1/people/~:(id,first-name,picture-url)',
'method post' => 0,
'field' => 'id',
'querypath' => 0,
),
'name' => array(
'resource' => 'https://api.linkedin.com/v1/people/~:(id,first-name,picture-url)',
'method post' => 0,
'field' => 'first-name',
'querypath' => 0,
),
'avatar' => array(
'resource' => 'https://api.linkedin.com/v1/people/~:(id,first-name,picture-url)',
'method post' => 0,
'field' => 'picture-url',
'querypath' => 0,
),
),
'format' => 'xml',
);
$facebook = new stdClass();
$facebook->name = '';
$facebook->title = 'Facebook';
$facebook->url = 'https://graph.facebook.com';
$facebook->consumer_advanced = array(
'oauth2' => 1,
'signature method' => 'HMAC-SHA1',
'authentication realm' => '',
'request token endpoint' => '/oauth/request_token',
'authorization scope' => 'email,read_stream',
'authorization endpoint' => 'https://www.facebook.com/dialog/oauth',
'access token endpoint' => '/oauth/access_token',
);
$facebook->mapping = array(
'fields' => array(
'uid' => array(
'resource' => 'https://graph.facebook.com/me',
'method post' => 0,
'field' => 'id',
'querypath' => 0,
),
'name' => array(
'resource' => 'https://graph.facebook.com/me',
'method post' => 0,
'field' => 'name',
'querypath' => 0,
),
'avatar' => array(
'resource' => '',
'method post' => 0,
'field' => '',
'querypath' => 0,
),
),
'format' => 'json',
);
$google = new stdClass();
$google->name = '';
$google->title = 'Google';
$google->url = 'https://accounts.google.com';
$google->consumer_advanced = array(
'oauth2' => 1,
'signature method' => 'HMAC-SHA1',
'authentication realm' => 'authorization_code',
'request token endpoint' => 'none',
'authorization scope' => 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email',
'authorization endpoint' => '/o/oauth2/auth',
'access token endpoint' => '/o/oauth2/token',
);
$google->mapping = array(
'fields' => array(
'uid' => array(
'resource' => 'https://www.googleapis.com/oauth2/v1/userinfo',
'method post' => 0,
'field' => 'id',
'querypath' => 0,
),
'name' => array(
'resource' => 'https://www.googleapis.com/oauth2/v1/userinfo',
'method post' => 0,
'field' => 'name',
'querypath' => 0,
),
'avatar' => array(
'resource' => '',
'method post' => 0,
'field' => 'picture',
'querypath' => 0,
),
),
'format' => 'json',
);
$flickr = new stdClass();
$flickr->name = '';
$flickr->title = 'Flickr';
$flickr->url = 'http://www.flickr.com';
$flickr->consumer_advanced = array(
'oauth2' => 0,
'signature method' => 'HMAC-SHA1',
'authentication realm' => '',
'request token endpoint' => '/services/oauth/request_token',
'authorization scope' => '',
'authorization endpoint' => '/services/oauth/authorize',
'access token endpoint' => '/services/oauth/access_token',
);
$flickr->mapping = array(
'fields' => array(
'uid' => array(
'resource' => 'http://api.flickr.com/services/rest/?method=flickr.test.login&format=json&nojsoncallback=1',
'method post' => 0,
'field' => 'user.id',
'querypath' => FALSE,
),
'name' => array(
'resource' => 'http://api.flickr.com/services/rest/?method=flickr.test.login&format=json&nojsoncallback=1',
'method post' => 0,
'field' => 'user.username._content',
'querypath' => FALSE,
),
'avatar' => array(
'resource' => '',
'method post' => 0,
'field' => '',
'querypath' => FALSE,
),
),
'format' => 'json',
);
$presets = array(
'twitter' => array(
'data' => $twitter,
'name' => 'Twitter',
),
'linkedin' => array(
'data' => $linkedin,
'name' => 'LinkedIn',
),
'facebook' => array(
'data' => $facebook,
'name' => 'Facebook',
),
'google' => array(
'data' => $google,
'name' => 'Google',
),
'flickr' => array(
'data' => $flickr,
'name' => 'Flickr',
),
);
drupal_alter('oauthconnector_presets', $presets);
return $presets;
}