Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yahoo! OAuth login screen for mobile devices

This is a kind of re-post of my question on Yahoo! forums. It is just that I refer to StackOverflow more frequently...

My problem is as following: while Yahoo! OAuth http://developer.yahoo.com/oauth/ is described as ready for use with mobile phones out-of-the-box it does not appear as such.

I have tried to implement sample application and use Yahoo! PHP SDK to connect with Yahoo! Using web browser it is all nice and easy. But while visiting Yahoo! request_auth page (http://developer.yahoo.com/oauth/guide/oauth-userauth.html) on my test mobile phone (Nokia 6300) it renders unacceptable: I am not able to see login box, cannot read information why my login would be required and all. I just see a page border and some text fragments ("Yahoo!", "Hel" (like in help...) et. al.).

Is there some parameter to force Yahoo! displaying mobile phone optimised page? I do redirect user to this address at the moment: https://api.login.yahoo.com/oauth/v2/request_auth

BTW: if I use Opera Mini - it renders page nicely, although ommiting information about my site (which is requesting log-in). Just that I cannot force all users to use Opera, or something.

Thanks in advance for any help.

like image 430
Justas Butkus Avatar asked Feb 24 '11 15:02

Justas Butkus


2 Answers

I've looking for a solution to this all day and eventually stumbled upon this: http://pastebin.com/8tDnrfLc

Important bit reproduced below:

var authPageURL = "https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=" + oauthToken;
var yahooMobileLoginUrl = "https://login.yahoo.com/m?&.src=oauth&.lang=en-us&.intl=us&.done=" + authPageURL;

Basically you direct the user to the mobile auth page and give it a url to go to when it's done. That url should be the original https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=... url.

Works for me!

like image 166
Michael Coffey Avatar answered Oct 16 '22 07:10

Michael Coffey


Yahoo! no doubt has a user-agent sniffing algorithm that determines what constitutes a mobile browser. Clearly Opera Mini triggers the right behavior. I suspect the native browser in the Nokia model you are using is not on the list, or it is emulating a desktop browser user-agent. Unfortunately I think you have to convince Yahoo! to deem your Nokia 6300 a mobile device.

like image 45
hoserdude Avatar answered Oct 16 '22 08:10

hoserdude