yf_oauth_driver_disqus class| File | plugins/oauth/classes/oauth/yf_oauth_driver_disqus.class.php |
|---|---|
| Use | _class('oauth_driver_disqus', 'classes/oauth/') |
| Extends | yf_oauth_driver2 |
A site sets them in its config with $PROJECT_CONF['oauth_driver_disqus']['NAME'] = ...;
| Property | Default | Description |
|---|---|---|
$get_access_token_method |
'POST' |
|
$scope |
'read' |
|
$url_params_access_token |
['grant_type' => 'authorization_code'] |
public function get_user_info()
public function get_user_info()
{
$access_token = $this->_storage_get('access_token');
if ( ! $access_token) {
$access_token = $this->get_access_token();
if ( ! $access_token) {
$this->_storage_clean();
js_redirect($this->redirect_uri, $url_rewrite = false);
return false;
}
}
if ( ! $this->_storage_get('user')) {
$url = $this->url_user . '?' . http_build_query([
'access_token' => $access_token,
'api_key' => $this->client_id,
'api_secret' => $this->client_secret,
]);
$opts = null;
$response = null;
$result = common()->get_remote_page($url, $cache = false, $opts, $response);
$result = $this->_decode_result($result, $response, __FUNCTION__);
if (isset($result['error']) || substr($response['http_code'], 0, 1) == '4') {
$this->_storage_clean();
js_redirect($this->redirect_uri, $url_rewrite = false);
return false;
}
$this->_storage_set('user_info_request', ['result' => $result, 'response' => $response]);
$this->_storage_set('user', $result);
}
return $this->_storage_get('user');
}
_ hooks and helpers; not routable as page actionspublic function _get_user_info_for_auth($raw = [])
public function _get_user_info_for_auth($raw = [])
{
$user_info = [
'user_id' => $raw['response']['id'],
'login' => $raw['response']['username'],
'name' => $raw['response']['name'],
'email' => '',
'avatar_url' => $raw['response']['avatar']['permalink'],
'profile_url' => $raw['response']['profileUrl'],
];
return $user_info;
}
from yf_oauth_driver2: _decode_result(), _storage_clean(), _storage_get(), _storage_set(), authorize(), get_access_token(), login()