Skip to content
This repository has been archived by the owner on Apr 8, 2019. It is now read-only.

Commit

Permalink
GTNPORTAL-3082 Facebook bugs with test users. Test users will be link…
Browse files Browse the repository at this point in the history
…ed to GateIn by FB id
  • Loading branch information
mposolda committed May 30, 2013
1 parent 6ac7d1a commit bab22d7
Showing 1 changed file with 7 additions and 1 deletion.
Expand Up @@ -212,7 +212,7 @@ protected FacebookPrincipal parseResponse(String httpResponse) throws JSONExcept

FacebookPrincipal facebookPrincipal = new FacebookPrincipal();
facebookPrincipal.setAccessToken(accessToken);
facebookPrincipal.setId(jsonObject.optString("id"));
facebookPrincipal.setId(jsonObject.getString("id"));
facebookPrincipal.setName(jsonObject.optString("name"));
facebookPrincipal.setUsername(jsonObject.optString("username"));
facebookPrincipal.setFirstName(jsonObject.optString("first_name"));
Expand All @@ -222,6 +222,12 @@ protected FacebookPrincipal parseResponse(String httpResponse) throws JSONExcept
facebookPrincipal.setLocale(jsonObject.optString("locale"));
facebookPrincipal.setEmail(jsonObject.optString("email"));
facebookPrincipal.setJsonObject(jsonObject);

// This could happen with Facebook testing users
if (facebookPrincipal.getUsername() == null || facebookPrincipal.getUsername().length() == 0) {
facebookPrincipal.setUsername(facebookPrincipal.getId());
}

return facebookPrincipal;
}

Expand Down

0 comments on commit bab22d7

Please sign in to comment.