本文整理汇总了PHP中oauth_client_class::GetAccessToken方法的典型用法代码示例。如果您正苦于以下问题:PHP oauth_client_class::GetAccessToken方法的具体用法?PHP oauth_client_class::GetAccessToken怎么用?PHP oauth_client_class::GetAccessToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oauth_client_class
的用法示例。
在下文中一共展示了oauth_client_class::GetAccessToken方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: service_social_login_naver
public static function service_social_login_naver()
{
if (isset($_GET['sym-api']) && $_GET['sym-api'] == 'service-social-login-naver') {
update_option(WSKL_PREFIX . 'sym-api-' . $_SERVER['HTTP_CLIENT_IP'], 'service-social-login-naver');
}
if (isset($_GET['sym-api']) && $_GET['sym-api'] == 'service-social-login-naver' || isset($_GET['code']) && get_option(WSKL_PREFIX . 'sym-api-' . $_SERVER['HTTP_CLIENT_IP']) == 'service-social-login-naver') {
require 'home-social-login/http.php';
require 'home-social-login/oauth_client.php';
$client = new oauth_client_class();
$client->debug = FALSE;
$client->debug_http = TRUE;
$client->server = 'Naver';
$client->redirect_uri = site_url() . '/index.php';
$client->client_id = get_option(wskl_get_option_name('naver_client_id'));
$client->client_secret = get_option(wskl_get_option_name('naver_client_secret'));
if (strlen($client->client_id) == 0 || strlen($client->client_secret) == 0) {
wskl_sym__alert('네이버 연동키값을 확인해 주세요.');
}
if ($login == 'Y') {
unset($_SESSION['OAUTH_STATE']);
$client->ResetAccessToken();
}
/* API permissions
*/
if ($success = $client->Initialize()) {
if ($success = $client->Process()) {
if (strlen($client->access_token)) {
$success = $client->CallAPI('https://apis.naver.com/nidlogin/nid/getUserProfile.xml', 'POST', array('mode' => 'userinfo'), array('FailOnAccessError' => TRUE), $user);
}
}
$success = $client->Finalize($success);
}
if ($client->exit) {
exit;
}
if ($success) {
$xml = simplexml_load_string($user);
if ($xml->result->resultcode == '00') {
$client->GetAccessToken($AccessToken);
$mb_gubun = 'naver';
$mb_id = $xml->response->enc_id;
$mb_name = $xml->response->nickname;
$mb_nick = $xml->response->nickname;
$mb_email = $xml->response->email;
$token_value = $AccessToken['value'];
$token_refresh = $AccessToken['refresh'];
$token_secret = '';
//$client->ResetAccessToken();
if (!trim($mb_id) || !trim($token_value)) {
wskl_sym__alert("정보가 제대로 넘어오지 않아 오류가 발생했습니다.");
}
$token_array = urlencode(static::encryptIt($mb_gubun . '|' . substr(str_replace('|', '', $mb_id), 0, 18) . '|' . $mb_name . '|' . $mb_nick . '|' . $mb_email));
$redirect_url = '/?sym-api=process-social-login&token=' . $token_array;
wp_redirect($redirect_url);
exit;
} else {
$error = htmlspecialchars($xml->result->resultcode);
alert_close($error);
}
} else {
$error = htmlspecialchars($client->error);
alert_close($error);
}
}
}