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



commit a204f59e71f6560728b22ff694aed1b5cde3bfdd
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 8d0814a..36f597a 100644
--- a/src/goabackend/goafacebookprovider.c
+++ b/src/goabackend/goafacebookprovider.c
@@ -250,12 +250,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]