Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$getAuth(), provider is undefined #759

Closed
tgensol opened this issue Jun 4, 2016 · 3 comments
Closed

$getAuth(), provider is undefined #759

tgensol opened this issue Jun 4, 2016 · 3 comments
Assignees

Comments

@tgensol
Copy link

tgensol commented Jun 4, 2016

Version info

Angular: 1.5.6

**Firebase:**3.0.3

AngularFire: 2.0.1

Other (e.g. Node, browser, operating system) (if applicable): Ionic

Test case

The doc says that $getAuth() returns :

uid, provider (string identifying the provider), auth (the authentication token payload), and expires (expiration time in seconds since the Unix epoch)

But

var authData = $scope.authObj.$getAuth();
authData.uid is okay, but authData.provider and authData.auth are undefined.

Steps to reproduce

var authData = $scope.authObj.$getAuth();
var provider = authData.provider
var uid = authData.uid

Expected behavior

If the doc is correct, provider should be a string, and it is currently "undefined"

Actual behavior

provider is "undefined".

@katowulf
Copy link
Contributor

katowulf commented Jun 4, 2016

Thanks for this. It looks like the doc is just a bit out of date. Will use this as a bug to track. To some extent, the data returned depends on the auth method being used and the scopes you've assigned.

See Get a user's profile. And Get a user's provider-specific information.

So long story short:

var user = firebase.auth().currentUser;
if (user != null) {
  user.providerData.forEach(function (profile) {
    console.log("Sign-in provider: "+profile.providerId);
    console.log("  Provider-specific UID: "+profile.uid);
    console.log("  Name: "+profile.displayName);
    console.log("  Email: "+profile.email);
    console.log("  Photo URL: "+profile.photoURL);
  });
}

@jwngr
Copy link

jwngr commented Jun 6, 2016

Thanks for opening the issue! @AbeHaskins may be able to handle this one. Otherwise, someone in the community can take on this docs bug.

@jwngr
Copy link

jwngr commented Jun 7, 2016

This should be resolved with #763. The field is now called providerId, not provider.

@jwngr jwngr closed this as completed in #763 Jun 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants