oauth-4-laravel icon indicating copy to clipboard operation
oauth-4-laravel copied to clipboard

requestRequestToken() has disappeared for Yahoo OAuth

Open anthonyshay opened this issue 10 years ago • 9 comments

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

anthonyshay avatar Nov 05 '15 21:11 anthonyshay

Hello, i have the same problem :(

Thank you a lot.

ddaattttaa avatar Nov 27 '15 08:11 ddaattttaa

The same problem here! :/

Did you guys solve the problem?

hugohcn avatar Nov 28 '15 19:11 hugohcn

Hi I have the same problem,

Help me please

FarhadMohammadi avatar Jan 07 '16 16:01 FarhadMohammadi

Hi , I'm having same issue ,

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

Thanks in advance .

webexpert4rv avatar Jun 15 '16 04:06 webexpert4rv

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, [email protected]

FarhadMohammadi avatar Jun 16 '16 05:06 FarhadMohammadi

Could you please post your custom code here?

On Wednesday, June 15, 2016, MailerLaravelDeveloper < [email protected]> 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, [email protected] javascript:_e(%7B%7D,'cvml','[email protected]');

— 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 .

anthonyshay avatar Jun 16 '16 05:06 anthonyshay

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

FarhadMohammadi avatar Jun 16 '16 05:06 FarhadMohammadi

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.

philip avatar Nov 09 '17 05:11 philip

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

ProMasoud avatar Dec 15 '17 08:12 ProMasoud