sreekantv / socialauth

Automatically exported from code.google.com/p/socialauth
0 stars 0 forks source link

Yahoo Login Failed Http Status 404 #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Intermittently when logging in using Yahoo it would fail. I would receive the 
following stacktrace in the logs when using YahooImpl.java v132

org.brickred.socialauth.exception.SocialAuthException: Failed to retrieve the 
user profile from  
http://social.yahooapis.com/v1/user/VLRBLTDPUM3DKFNMIXMAI2YNVU<!-- 
oauth02.member.re3.yahoo.com uncompressed/chunked Mon Jan 17 11:07:02 PST 2011 
-->
/profile?format=json. Staus :404
    at org.brickred.socialauth.provider.YahooImpl.getUserProfile(YahooImpl.java:224)
    at org.brickred.socialauth.provider.YahooImpl.verifyResponse(YahooImpl.java:191)

The issue is caused because of the lines 204 and 205
String url = String.format(PROFILE_URL, token
                .getAttribute("xoauth_yahoo_guid"));

For some reason token.getAttribute("xoauth_yahoo_guid") intermittently returns 
a comment of "<!-- oauth02.member.re3.yahoo.com uncompressed/chunked Mon Jan 17 
11:07:02 PST 2011 -->" along with the xoauth_yahoo_guid. Therefore lines 204 
and 205 create a malformed url (see below) which results in a http status 404 
(Not Found) 

http://social.yahooapis.com/v1/user/VLRBLTDPUM3DKFNMIXMAI2YNVU<!-- 
oauth02.member.re3.yahoo.com uncompressed/chunked Mon Jan 17 11:07:02 PST 2011 
-->
/profile?format=json

The following is a patch for YahooImpl.java v132 lines 204 and 205 that fixes 
this issue.

String guid = (String) token.getAttribute("xoauth_yahoo_guid");
if (guid.indexOf("<") != -1)
{
    guid = guid.substring(0, guid.indexOf("<")).trim();
}
String url = String.format(PROFILE_URL, guid);

Original issue reported on code.google.com by alangi...@gmail.com on 18 Jan 2011 at 11:13

GoogleCodeExporter commented 9 years ago
Thanks a lot for the debugging and solving this issue. We have checked in the 
code and have also checked in a pom.xml so that you can build the jar quickly.

Warm regards,
Abhinav

Original comment by tsg.bric...@gmail.com on 18 Jan 2011 at 5:38