Facebook Authentication -- Cant Test


#1

Guys i am trying to learn facebook authentication, it may even be working i just cant test it.

when the user clicks on the Facebook button on my App (at my PC) it calls a method called doFacebook()

its getting called because i have a alert and a log that gets rendered,

but when it hits this line

this.facebookAuth.login().then(() => {
      this.navCtrl.setRoot(HomePage);
    });

everything stops and nothing happens it never goes into the then condition

does anyone know how i can test it on my PC?

Thanks in Advance!


#2

Where does this come from? Ionic Native? Please provide a link to the library.


#3

this is the import {FacebookAuth, User, AuthLoginResult} from '@ionic/cloud-angular'; library

from another example i even tried

var loginDetails = await this.facebook.login();
     console.log(this.loginDetails);

i am trying to debug it on a PC dont have a mac

anyway i can get a emulator to work on a pc for iphone or android so that i can debug the login?

i really dont know which one will be good, can you help


#4

tried on a emulator and also on a Android, still no cigar. can someone help me for social login


#5

what error are you getting because i tried official of fb plugin implementation documentation and it is working


#6

Okay, so you are using Ionic Native https://docs.ionic.io/services/auth/ where you try to use Facebook Authentication https://docs.ionic.io/services/auth/facebook-auth.html. Correct?

This is the information that should be in the first post - otherwise nobody knows what you are working on.


#7

Yes this is something i can try, i was not using the inapp browser.

what do you use to test, can it be done on a WebBrowser? i dont have a MAC


#8

The in app browser example you sent actually worked. Thank you soo much for
your help

I was trying without the in app browser and was failing

One concern in the in app browser example it does not use the logged in
user instead I get the Facebook login user/password is there a way to use
the current logged in user?


#9

What I showed you is the official documentation of the library you are implementing :wink:


#10

Thank you. Is there a way to get the logged in user automatically instead of asking them to log in again. Sorry I didn’t understood :frowning:


#11

Probably not as the InAppBrowser is not the normal browser.

You will probably have to switch to the native facebook login:
https://docs.ionic.io/services/auth/facebook-native.html
(Although I am not 100% sure it is different there…)


#12

So that is the issue withe Native Approch i have installed the following

plugin add cordova-plugin-facebook4 --save --variable APP_ID="119079515323058" --variable APP_NAME="Communities"

my login method is

 login() {
      try {
  
  
        var loginDetails = this.facebook.login().then(result => {
           alert(result);        
        });
       
      }
      catch (e) {
        console.log(e);
        alert(e);
      }
    }
  

My login method was also tried with await with no diff in results

i have been following that article thoroughly, but when i click the login button nothing happens the code goes into a eternal wait on my android.

any one has it working? what is needed for this example to work. i am stuck on the native login


#13

Did you remote debug the problem on the device already? Follow these instructions here to debug the problem in Chrome dev tools: https://ionic.zone/debug/remote-debug-your-app#android Look at the console and network tabs for errors.


#14

Hello,

I have the same problem.

    $scope.facebookLogin = function () {
        try {
        $ionicFacebookAuth.login().then(
        $state.go('menu.home');    
        });
       
      }
      catch (e) {
        console.log(e);
        alert(e);
      }
    }

And it doesn’t do anything and i don’t get any error.


#15

This thread was about multiple things, some that got resolved. Could you please open a new topic with all the necessary information (ionic info output, plugins used, where and what you are testing etc.) to maybe help you debug your problem? I don’t want to hijack this discussion.


#16

Even my issue still exist same problem. I have shelved it for now :frowning: