artdarek / oauth-4-laravel

OAuth Service Provider for Laravel 4
683 stars 215 forks source link

requestRequestToken() has disappeared for Yahoo OAuth #164

Open anthonyshay opened 9 years ago

anthonyshay commented 9 years ago

I've been using OAuth for a long time, and recently there's been a problem with Yahoo OAuth, I'm getting Call to undefined method OAuth\OAuth2\Service\Yahoo::requestRequestToken()

I'm using the exact code that is in the example:

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

Can anyone help on this?

Thanks

ddaattttaa commented 8 years ago

Hello, i have the same problem :(

Thank you a lot.

hugohcn commented 8 years ago

The same problem here! :/

Did you guys solve the problem?

FarhadMohammadi commented 8 years ago

Hi I have the same problem,

Help me please

webexpert4rv commented 8 years ago

Hi , I'm having same issue ,

Is there any conflict b/w laravel/socialite and oriceon/oauth-5-laravel .

Thanks in advance .

FarhadMohammadi commented 8 years ago

Google or Yahoo service providres use OAUTH2 authenticatin, You should use newest packages or any kind of library for using this services or for Yahoo services I wrote some custom codes that works for laravel framework,

if any body need it i can send them, mailer.laravel.developer@gmail.com

anthonyshay commented 8 years ago

Could you please post your custom code here?

On Wednesday, June 15, 2016, MailerLaravelDeveloper < notifications@github.com> wrote:

Google or Yahoo service providres use OAUTH2 authenticatin, You should use newest packages or any kind of library for using this services or for Yahoo services I wrote some custom codes that works for laravel framework,

if any body need it i can send them, mailer.laravel.developer@gmail.com javascript:_e(%7B%7D,'cvml','mailer.laravel.developer@gmail.com');

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/artdarek/oauth-4-laravel/issues/164#issuecomment-226390117, or mute the thread https://github.com/notifications/unsubscribe/ANHY5ziaNBOZaTw53lZEhQ147Lnea2p5ks5qMNvGgaJpZM4Gc_Xq .

FarhadMohammadi commented 8 years ago

I wrote a class Yahoo.php in app/classes directory of laravel framework that read my yahoo contacts, of course this is customed to my project, you can change it if you want, And if you saw any bugs please report me :) :)

https://github.com/FarhadMohammadi/yahoo

You'r yahoo developer console configs should be correct with callback route that returned information from yahoo, for example for me

in yahoo developer console callback path is: http://domain/user/contacts/import/yahoo, that equal to route path in my route files

I hope that works

philip commented 7 years ago

It appears this problem relates to OAuth1 versus OAuth2 as requestRequestToken() only applies to OAuth1. I only looked briefly (as I've moved on) but, for example, disabling OAuth2 in PHPoAuthLib allows this to work as requestRequestToken() is now defined. Perhaps someone else will offer a real solution.

ProMasoud commented 6 years ago

This is a working answer in stackoverflow

Use this code:

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

instead of this code:

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