From the course: Building Applications with Angular, ASP.NET Core, and Entity Framework Core

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Save token in the browser

Save token in the browser

From the course: Building Applications with Angular, ASP.NET Core, and Entity Framework Core

Start my 1-month free trial

Save token in the browser

- [Instructor] In this video, we'll create our register service function in our frontend, in order to send our register data to the backend. If you look at api service, it's getting quite big. So I wouldn't want to put any authentication calls inside here. Instead, let's create a new service for authentication. So I'll add a new file to our app called auth.service.ts. Then let's copy our api service, and paste it in as a template. I'll get rid of the observable properties above the constructor between line eight and 12. And I'll rename the class to auth service. And then I'll get rid of all but one function from inside the class. And I'll rename this to register. And this will take in credentials. Then instead of http.get on line 11, I'll change that to post and I'll update the URL with api/account and we won't need a URL parameter so I'll get rid of that. And then we'll pass in object credentials as a second parameter. Then instead of returning this as an observable, I'll subscribe…

Contents