jzyuchen/oauth-client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jzyuchen/oauth-client

Composer 安装命令:

composer require jzyuchen/oauth-client

包简介

oauth client for laravel

README 文档

README

qq, weibo, weixin oauth for laravel 5

QQ 调用示例

1.获取QQ验证的用户确认URL

$oauth = new OAuthClient();
$qq = $oauth->get('qq');
echo $qq->getAuthorizationUrl();

2.QQ回调处理

$oauth = new OAuthClient();
$provider = $oauth->get('qq');
// Try to get an access token (using the authorization code grant)
$token = $provider->getAccessToken('authorization_code', [
    'code' => Input::get('code')
]);

// Optional: Now you have a token you can look up a users profile data
try {

    // We got an access token, let's now get the user's details
    $userDetails = $provider->getUserDetails($token);
    // Use these details to create a new profile
    printf('Hello %s!', $userDetails->firstName);

} catch (Exception $e) {

    // Failed to get user details
    exit('Oh dear...');
}

echo '<pre>';
var_dump($userDetails);
echo "\n";

// Use this to interact with an API on the users behalf
echo $token->accessToken."\n";

// Use this to get a new access token if the old one expires
echo $token->refreshToken."\n";

// Number of seconds until the access token will expire, and need refreshing
echo $token->expires."\n";

var_dump($token);
echo '</pre>';

统计信息

  • 总下载量: 57
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 9
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 9
  • Watchers: 1
  • Forks: 6
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-05-12