3
我使用這個庫 https://github.com/artdarek/oauth-4-laravel雅虎應用程序認證Laravel
這裏是我的代碼
public function loginWithYahoo() {
// get data from input
$token = Input::get('oauth_token');
$verify = Input::get('oauth_verifier');
// get yahoo service
$yh = OAuth::consumer('Yahoo');
// if code is provided get user data and sign in
if (!empty($token) && !empty($verify)) {
// This was a callback request from yahoo, get the token
$token = $yh->requestAccessToken($token, $verify);
$xid = array($token->getExtraParams());
$result = json_decode($yh->request('https://social.yahooapis.com/v1/user/'.$xid[0]['xoauth_yahoo_guid'].'/profile?format=json'), true);
dd($result);
}
// if not ask for permission first
else {
// get request token
$reqToken = $yh->requestRequestToken();
// get Authorization Uri sending the request token
$url = $yh->getAuthorizationUri(array('oauth_token' => $reqToken->getRequestToken()));
// return to yahoo login url
return Redirect::to((string)$url);
}
}.
我收到以下錯誤..任何一個可以請給一些提示???在此先感謝 調用未定義的方法OAuth \ OAuth2 \ Service \ Yahoo :: requestRequestToken()
你應該包括*爲什麼*這會有所幫助。 –