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
From the course: Building Applications with Angular, ASP.NET Core, and Entity Framework Core
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Set up Identity Framework13m 31s
-
(Locked)
Register from Angular4m 26s
-
(Locked)
Reactive forms with FormBuilder5m 49s
-
(Locked)
Save token in the browser3m 39s
-
(Locked)
Pass token with Angular requests5m 6s
-
(Locked)
Auth token middleware in ASP.NET7m 55s
-
(Locked)
Associate user with quiz and question5m 35s
-
(Locked)
Logging in6m 38s
-
(Locked)
Logging out3m 23s
-
(Locked)
-
-