hannesvdvreken / oauth
v0.0.5
2014-03-18 12:18 UTC
Requires
- php: >=5.3
- lusitanian/oauth: *
Requires (Dev)
- illuminate/session: 4.1.*
- illuminate/support: 4.1.*
- mockery/mockery: 0.8.*
This package is auto-updated.
Last update: 2022-02-01 12:34:33 UTC
README
建议:这只是一个用于令牌存储的 Laravel Session 类的服务提供者。如果您想继续使用 Lusitanian 的 PHPoAuthLib,请使用 artdarek/oauth-4-laravel
,由 Dariusz Prząda 提供。如果您对基于 Guzzle 的服务类感兴趣,请看这里!
使用方法
按照以下步骤操作,您将能够获取一个具有一个规则的服务类的对象
$fb = OAuth::consumer('Facebook'); $fb = OAuth::consumer('Facebook', 'https://example.com/callback');
可选地,添加一个带有服务需要重定向到的 URL 的第二个参数。默认情况下,它使用 Laravel (L4) 提供的 URL::current()
如何集成
别名
在 app/config/app.php 文件的底部添加一个别名
'OAuth' => 'hannesvdvreken\OAuth\facade\OAuth',
并在 providers 数组的底部注册此服务提供者
'providers' => array( ... 'hannesvdvreken\OAuth\OAuthServiceProvider', ),
凭证
将您的凭证添加到 app/config/oauth.php
return array( /** * One of 'StreamClient' or 'CurlClient'. Defaults to 'StreamClient' if not provided. */ 'client' => 'StreamClient', 'consumers' => array( 'Facebook' => array( 'client_id' => '', 'client_secret' => '', 'scope' => array(), ), ), );