-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Update Profile Details Using Angularfire 2 + Firebase 3.x #281
Comments
I think the way to go about this is to store extra profile data in a normal firebase database with the associated username/UID. |
From the docs it looks like firebase has fields on the auth object for a user's displayName and profile photo etc: https://firebase.google.com/docs/auth/web/manage-users Are you planning on including this in the angularfire2 lib? |
Looks like you can get at through authState.auth.updateProfile({
displayName: 'display name',
photoURL: 'some/url'
}).then(() => {
...
}); The typings are a little strict on it if you are using typescript. So you have to pass both |
@burtonjc from where can you call this? if in my modification class i have where on |
Because that value is wrapped in an observable I think you have to subscribe to get it. You might be able to do something fancy with BehaviorSubjects but I'm not sure. To avoid subscribing to auth states all over the place, you could create a service to manage the subscription: import { Injectable } from '@angular/core';
import { FirebaseAuth, FirebaseAuthState } from 'angularfire2';
@Injectable()
export class AuthService {
private _authState: FirebaseAuthState = null;
constructor(public auth: FirebaseAuth) {
this.auth.subscribe((state: FirebaseAuthState) => {
this._authState = state;
});
}
get authenticated(): boolean {
return this._authState !== null;
}
get authState(): FirebaseAuthState {
return this._authState;
}
} The danger there is if you call Hope that helps! |
@psaussure I am facing the exact same problem as you are asking. Did you get it to work? If yes, then how? Please help. |
I think the best way to update the profile is using native firebase, just import it and use it like this:
|
|
How to update phone number of user in angularfire2? |
Before you try, make sure you have recently logged in. Try to log out and then log in...then run another test. |
I get an error that |
use |
|
Hi!
I would like to include more information in the profile, with angularfire2 is possible? how to proceed? In the case without the Google authentication using only email and password ...
Thanks in advance!
The text was updated successfully, but these errors were encountered: