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

feat(auth): Add ability to link user with email credentials to current user #932

Closed

Conversation

idanen
Copy link
Contributor

@idanen idanen commented May 23, 2017

Description

Adding the ability to link a user to a new user with email and password.

Code sample

angular.module('some-module', ['firebase'])
  .controller('MyCtrl', function MyCtrl($fireabseAuth) {
    this.authObj = $firebaseAuth();
    // ... Assuming user logged in somehow. Anonymously, or with other credentials
    this.user = this.authObj.$getAuth();

    // ... other logic ...

    // This could be linked to some `ng-click` for example
    this.linkUser = function (email, password) {
        this.authObj.$linkUser(email, password)
            .then(function (authData) {
                // This will not trigger a `$digest`, so do so if needed using `$timeout`, `$scope.$apply` or whatever suits you.
                this.user = authData;
            }.bind(this));
    };

    // Another way to get the user: listening to `$onAuthStateChanged`
    this.authObj.$onAuthStateChanged(function(firebaseUser) {
      if (firebaseUser) {
        console.log("Signed in as:", firebaseUser.uid);
        this.user = firebaseUser;
      } else {
        console.log("Signed out");
        this.user = undefined;
      }
    });
  });

Add the $linkUser method. #764

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

1 similar comment
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling c004904 on idanen:feature/firebase-3-link-user into ** on firebase:master**.

@idanen
Copy link
Contributor Author

idanen commented May 24, 2017

Is the CLA check going to re-run at some time?

Or should I replace author email (folowing these steps)?

@googlebot
Copy link

CLAs look good, thanks!

@jamesdaniels
Copy link
Contributor

Thanks for the contribution however we're only considering security fixes at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants