Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Brad Woods
Brad Woods
13,772 Points

Authentication with AngularJS and Firebase

Has anyone come across a good example/ explanation of authentication using AngularJS and Firebase (using Anglefire)? There is as example on the offical website (https://www.firebase.com/docs/web/guide/login/password.html) but it doesn't explain much.

Ken Alger
Ken Alger
Treehouse Teacher

Brad;

I have not worked with Firebase at all but looked at the link you provided and was wondering what additional information you were hoping to learn?

Ken

Marty Hitchcock
Marty Hitchcock
13,108 Points

I could try explain it in vanilla JS if that would help? I am yet to learn angular js so i'm not help there. But I too struggled working out how to get authentication working at first so if it is authentication on firebase in general you are having trouble with rather than authentication with angular specifically then let me know.

1 Answer

Brad Woods
Brad Woods
13,772 Points

Ken,

I don't feel the website does a good job of explaining how to integrate the code snippets into an Angular app. For example, the website contains the following - Create new user accounts with the following snippet:

ref.createUser({ email : "bobtony@firebase.com", password : "correcthorsebatterystaple" }, function(error) { if (error === null) { console.log("User created successfully"); } else { console.log("Error creating user:", error); } });

I assume the 'ref' variable is a reference URL to my firebase and 'ref.createUser' is a method that is called through the reference. When i try to run this method however I get a javascript error 'undefined is not a function'. I have 3-way data binding working fine so I know my link to my firebase is fine so it leads me to believe there is more that needs to be done rather than just copying/ pasting this into an app.