wobsoriano
wobsoriano

Reputation: 13434

AngularFire cordova Oauth not functioning

So I am building an ionic app with angularfire auth but $signInWithRedirect and $signInWithPopUp won't work because of the environment http/https thing so I added the cordovaOauth plugin and my code looks like this:

  $cordovaOauth.facebook("app_id", ["email"]).then(function (result) {
  alert(result.access_token); //i get this alert
    Auth.$signInWithCredentials(result.access_token).then(function (firebaseUser) {
      alert('success'); 
      alert(firebaseUser);
      $scope.firebaseUser = firebaseUser;
    }, function (error) {
      alert(error);
    });
  }, function (error) {
    alert(error);
  });

When I run this I get the alert result.access_token though I'm not going to the next alerts meaning I have a problem with my $signInWithCredentials.

Am I missing something here? Any help would be much appreciated.

Upvotes: 0

Views: 68

Answers (1)

bojeil
bojeil

Reputation: 30788

$signInWithCredentials should be $signInWithCredential You also have to wrap the access token in a credential object: $signInWithCredential(firebase.auth.FacebookAuthProvider.credential(result.access_token));

Upvotes: 1

Related Questions