dev-master
9999999-dev http://chrisyue.com/
MIT
The Requires
- php >=5.3.9
- symfony/symfony >=2.6
- guzzlehttp/guzzle ~6.1
by Chris Yue
oauth
Wallogit.com
2017 © Pedro Peláez
某些OAuth2.0用户提供商,可能要求只能设置一个redirect_uri host,但是你却想使用多个redirect_uri host,如果是这种情况,此库适合你。, (*1)
在用户登录时,分为获取code和获取access token两个步骤。, (*2)
只有在获取code步骤,公众号设置的redirect_uri才用作用(限制使用公众号的域名的作用), (*3)
而获取access token 阶段完全没有此限制,直接使用code获取就行了, (*4)
$ composer require chrisyue/dark-portal-bundle:dev-master
然后在AppKernel里开启此Bundle你懂的, (*5)
设置security.yml文件:, (*6)
providers:
oauth:
id: chrisyue_dark_portal.security.user.provider
firewalls:
secured_area:
pattern: ^/
oauth_code:
appid: %your_appid%
secret: %your_secret%
scope: %your_scope%
code_endpoint: %your_code_endpoint% # 不着急,此字段意义见后面
provider: oauth
比如wechat.xxx.com和weixin.xxx.com都需要使用同一个微信公众账号登录,公众账号只能设置一个redirect_uri的域名。, (*7)
将一台服务器设置为专门的获取code的服务器,比如:oauth-code.xxx.com, (*8)
将get-code.php代码部署到服务器,部署前可设置能使用此服务的域名:, (*9)
$hosts = [
'wechat.xxx.com',
'weixin.xxx.com',
];
假如部署后此脚本路径为http://oauth-code.xxx.com/get-code.php,那么your_code_endpoint参数的值就是它。, (*10)
MIT
oauth