From the course: Angular: Creating and Hosting a Full-Stack Site

Unlock the full course today

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

Create listings with Auth

Create listings with Auth

From the course: Angular: Creating and Hosting a Full-Stack Site

Start my 1-month free trial

Create listings with Auth

- [Instructor] So let's take a look at how to incorporate authentication into our new listings page and the corresponding server end point. Now, just like with getting a user's listings, we're going to start off by modifying the create listing method in the listing service. This will probably look very familiar. We're going to say something like this. We're going to say return new observable listing, and then we're going to say observer, and we're going to say this dot auth dot user dot subscribe, and get the currently authenticated user. And then we're going to get the user's auth token, so we're going to say user and user dot get ID token, and then we're going to say dot then, since this is a promise, and we're going to say token, and once we have the token we're going to copy and paste the original request like this without the return statement. So we're going to say this dot http dot post listing. We're going to send it…

Contents