YurunOAuthLogin v2.0.4 release, added support for QQ small Authorization

YurunOAuthLogin PHP is a third-party login authorization SDK, integrates up to nine platforms, including QQ, micro letter, microblogging, Github and other common interfaces. Can be easily embedded support for PHP> = 5.4 in any system, version 2.0 now supports Swoole coroutine environment.

We have a sound technical documentation online: http://doc.yurunsoft.com/YurunOAuthLogin

API documentation: https://apidoc.gitee.com/yurunsoft/YurunOAuthLogin

I am sure you will be docked in the development of a wide variety of third-party platform, my personal energy is limited, to welcome you to submit a PR ( code cloud / Github ), perfect it together, it can support more platforms, more easy to use.

v2.0.4 update log

  • Added support for QQ small Authorization (code change sessionKey, decryption)
  • Added support for small micro-channel program authorized data decryption (previously supported only code change sessionKey)

installation

Configure your composer.json join in:

{
    "require": {
        "yurunsoft/yurun-oauth-login": "~2.0"
    }
}

Supported sign-on platform

  • QQ

  • Micro-letter code page scan, the micro-channel authorization

  • BiHiroshi

  • Baidu

  • Github

  • Gitee

  • Coding

  • Open Source China (OSChina)

  • CSDN

Follow-up will continue to add new platform support, you are welcome to submit PR, perfect together!

Code examples

Since v1.2 from all unified method arguments, if additional parameters can be assigned using the object properties, with particular reference to the test code test directory.

The following example code to the interface QQ, QQ can put any interface other words to the words used.

Instantiation

$qqOAuth = new \Yurun\OAuthLogin\QQ\OAuth2('appid', 'appkey', 'callbackUrl');

log in

$url = $qqOAuth->getAuthUrl();
$_SESSION['YURUN_QQ_STATE'] = $qqOAuth->state;
header('location:' . $url);

Callback handler

// Get accessToken 
$ $ qqOAuth- accessToken => getAccessToken ($ _ the SESSION [ 'YURUN_QQ_STATE']); 

// Call through such methods may also be acquired getAccessToken 
@ $ $ qqOAuth- accessToken => accessToken; 
// this is a getAccessToken api request return result 
// $ result = $ qqOAuth-> result; 

// user 
$ $ qqOAuth- the userInfo => getUserInfo (); 

// this is a getAccessToken api request return result 
// $ result = $ qqOAuth-> result ; 

// user uniquely identifies 
$ openid = $ qqOAuth-> openid;

Sign in to resolve domain names can only set a callback problem

// Set a callback can only solve the problem domain, the following address need to change the address in your project, you can refer to test / QQ / loginAgent.php wording of 
$ qqOAuth-> loginAgentUrl = 'http: // localhost / test / QQ / loginAgent.php '; 

$ URL = $ qqOAuth-> getAuthUrl (); 
$ _SESSION [' YURUN_QQ_STATE '] = $ qqOAuth-> State; 
header (' LOCATION:. '$ URL);

Swoole coroutine support environment

\ Yurun \ Util \ YurunHttp :: setDefaultHandler ( 'Yurun \ Util \ YurunHttp \ Handler \ Swoole');

Guess you like

Origin www.oschina.net/news/110187/yurunoauthlogin-2-0-4-released