Auth Service - Login

Let's create an authentication service for login functionality.

At the moment, our signup service returns a user object. In our SignupComponent, we’re logging that result to the console with a comment stating that we’ll eventually redirect the user to a dashboard, which we’ll create in the next chapter. By redirecting users to a dashboard when they signup, we’re effectively logging in a user on their behalf in addition to creating their account. So before we progress to the dashboard, we’ll need to create one more method, login, in our AuthService (returning users who’ve already created an account will have a separate login section we’ll be creating later).

If you return back to the API documentation section, you should see a section labeled “Sessions”. This is the endpoint we’ll need to hit to log in a user.

Get hands-on with 1200+ tech skills courses.