4
votes

Cause i'm new to the whole angular (specific angular2) thing i wonder about something.

I want to build an "api" backend with rails 5 as they released the api mode and my frontend with angular2. Because i'm used to rails i wanted to implement a devise user authentication and because i'm new to angular2 i searched for a way to authenticate the user against my rails/devise backend.

But all i find are tutorials about angular2 and auth0, which i never heared before.

So my question is, is it "normal" to user angular2 with auth0 authentication? And when i use auth0 my user data are not in my database right? So how do i create relationships with my rails models?

Would be great if someone can explain that to me or link me some article if they exists.

2

2 Answers

4
votes

Auth0 is one of the many choices available to you. If you'd like to use Auth0 but store credentials in your own database, there is a tutorial for setting that up with Auth0.

So it can be normal to use Auth0, and you can also have your user data available in your own database-- do keep in mind you'll need to secure user credentials thoroughly when storing them yourself though!

1
votes

I've also faced the same problem and considered Devise (going so far as setting up a Rails+Devise landing page that redirected users to the Angular app after successful login). After much pain I have come to the same recommendation as Kassandra, that using JWT authentication is the way to go.

However, if you plan to use Auth0 note that after 7000 users have signed up you will need to upgrade. This may not be a problem for you but since I plan to deploy something substantial it's a decision I had to think about.