[gnome-online-accounts/gnome-3-14] facebook: Add fallback to get presentation id



commit cfcdbd460d21b559601651fcbea6eba6c9e4323b
Author: Thomas Bechtold <thomasbechtold jpberlin de>
Date:   Sat Oct 25 14:44:35 2014 +0200

    facebook: Add fallback to get presentation id
    
    After the facebook login, the email address from the returned json
    object is used as presentation identity. Seems that the email is not
    always availale. In this case, use the username from the json object as
    fallback.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=739168

 src/goabackend/goafacebookprovider.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/goabackend/goafacebookprovider.c b/src/goabackend/goafacebookprovider.c
index 93e326b..ceb897e 100644
--- a/src/goabackend/goafacebookprovider.c
+++ b/src/goabackend/goafacebookprovider.c
@@ -252,12 +252,16 @@ get_identity_sync (GoaOAuth2Provider  *provider,
   presentation_identity = g_strdup (json_object_get_string_member (json_object, "email"));
   if (presentation_identity == NULL)
     {
-      g_warning ("Did not find email in JSON data");
-      g_set_error (error,
-                   GOA_ERROR,
-                   GOA_ERROR_FAILED,
-                   _("Could not parse response"));
-      goto out;
+      presentation_identity = g_strdup (json_object_get_string_member (json_object, "username"));
+      if (presentation_identity == NULL)
+        {
+          g_warning ("Did not find email or username in JSON data");
+          g_set_error (error,
+                       GOA_ERROR,
+                       GOA_ERROR_FAILED,
+                       _("Could not parse response"));
+          goto out;
+        }
     }
 
   ret = id;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]