Mike hace 3 años
padre
commit
d94ecc2433
Se han modificado 1 ficheros con 8 adiciones y 7 borrados
  1. 8 7
      desktop11/index.html

+ 8 - 7
desktop11/index.html

@@ -47,9 +47,7 @@ function checkLoginState() {               // Called when a person is finished w
         console.log(statusChangeCallback(response));
     });
 
-    FB.login(function(response) {
-        console.log('FB.login: ' + response);
-    }, {scope: 'public_profile,email'});
+    testAPI();
 }
 
 window.fbAsyncInit = function() {
@@ -62,21 +60,24 @@ window.fbAsyncInit = function() {
 
     FB.getLoginStatus(function(response) {   // Called after the JS SDK has been initialized.
         statusChangeCallback(response);        // Returns the login status.
-    });
+    });
 };
 
 function testAPI() {                      // Testing Graph API after login.  See statusChangeCallback() for when this call is made.
     console.log('Welcome!  Fetching your information.... ');
+    
+    FB.login(function(response) {
+        console.log('FB.login: ' + JSON.stringify(response));
+    }, {scope: 'public_profile,email'});
+    
     FB.api('/me', function(response) {
-        console.log('testAPI(): ' + response);
+        console.log('testAPI(): ' + response.);
         console.log('Successful login for: ' + response.name + ', email = ' + response.email);
         document.getElementById('status').innerHTML =
             'Thanks for logging in, ' + response.name + '!';
     });
 }
 
-testAPI();
-
 function callFB() {
     FB.login(function(response) {
         if (response.authResponse) {