首先我想簡單地想知道如何使用oauth作品。我們需要通過這個插件以及這個插件將返回什麼。我們是否需要爲不同的php框架定製插件?我已經看到他們是不同的框架oauth的不同擴展,爲什麼?需要通過oauth插件使用Twitter,Google,Facebook Apis驗證用戶?
我需要在Yii框架使用社交網絡的用戶進行身份驗證,我已經集成警予的eouath擴展使用OAuth,並取得了使用訪問谷歌用戶的廣告服務這樣
公共職能actionGoogleAds行動(){
Yii::import('ext.eoauth.*');
$ui = new EOAuthUserIdentity(
array(
//Set the "scope" to the service you want to use
'scope'=>'https://sandbox.google.com/apis/ads/publisher/',
'provider'=>array(
'request'=>'https://www.google.com/accounts/OAuthGetRequestToken',
'authorize'=>'https://www.google.com/accounts/OAuthAuthorizeToken',
'access'=>'https://www.google.com/accounts/OAuthGetAccessToken',
)
)
);
if ($ui->authenticate()) {
$user=Yii::app()->user;
$user->login($ui);
$this->redirect($user->returnUrl);
}
else throw new CHttpException(401, $ui->error);
}
如果我想使用其他的服務,如LinkedIn,Facebook,微博只是註冊用戶,我應該只是改變範圍和參數,或者也不得不做出一些改變別處。如何將用戶信息存儲在我自己的數據庫中?