FirebaseExtended / angularfire

AngularJS bindings for Firebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Adding scope to signInWithPopup

Nicolazinho opened this issue · comments

Hi Firebase team,

Any idea how I can add scope to receive special permissions (eg. user_location) with $signInWithPopup? It seems that the service is not accepting any other parameters.

I am looking to use the Javascript FacebookAuthProvider addScope for Angularfire.

Thanks

Create a new FacebookAuthProvider with the scope added and pass the provider to the $signInWithPopup() as a parameter. The documentation says you can pass providers also as parameter.

I added an example of how to do this using AngularFire with #896. It should get merged in shortly.

For your Facebook example, your code will look something like this:

var provider = new firebase.auth.FacebookAuthProvider();
provider.addScope("user_location");

$scope.authObj.$signInWithPopup(provider).then(function(result) {
  console.log("Signed in as:", result.user.uid);
}).catch(function(error) {
  console.error("Authentication failed:", error);
});

@jwngr Whenever i add a provider for example (provider.addScope('id,name,posts') OR provider.addScope('posts') )
facebook gives an error like "Sorry, something went wrong. we're working on getting this fixed as soon as we can"