【问题标题】:Yahoo App Authentication Laravel雅虎应用认证 Laravel
【发布时间】:2016-01-14 19:04:59
【问题描述】:

我正在使用这个库 https://github.com/artdarek/oauth-4-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()

【问题讨论】:

    标签: php oauth laravel-5 yahoo-api


    【解决方案1】:

    使用此代码:

    $url = $yh->getAuthorizationUri();
    return redirect((string)$url);
    

    代替这段代码:

    // 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 );
    

    【讨论】:

    • 你应该包括为什么这有帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-25
    • 2011-06-29
    • 1970-01-01
    • 2023-02-21
    相关资源
    最近更新 更多