For everyone after we already create the sign.
Let me remove the RC function right here.
We need to generate a JSON web token after here.
Right after we save the data into the database successfully, we will generate the JSON web token.
Let me create a save user.
And this is the promise right?
For that reason you can write over here and remove something and return save user.
That's the first thing.
And after here we need to generate the JSON web Oh, God.
Well, how to do that right now?
Let's click on authentication from the security and click into the token.
We need to install the package right here.
After that let me show you how we can generate the JSON web token.
Scroll a little bit to read the documentation.
Okay.
Firstly we need to import the library service into our service right here.
Right.
We can import over here.
We need to inject JSON web token service.
And after that, but before going further, let's check the terminal.
If we scroll a little bit, you will see it has some error from the authentication module.
The reason because right here we inject the service but we don't enable the module yet right.
Open the module.
Inside here we need to invoke the module.
Actually we can evolve below.
Because I eat orderly work.
If you scroll a bit over here, you can see it also involves the stability module.
And from the module we can revisit the to put the some option over here for example like market will
be global okay.
It later in the other module we want to use the update.
It also work and global over here and secret and sign option.
Let me copy everything and boost over here.
And you can say with the secret will reward the some secret over here right.
But I want to separate it into the environment variable.
Let me show you inside are a fully unique toe boots that simulates a width and inspiration over here,
and with a cigarette.
You can shop some online tools with me, like a cigarette lighter, and you can show one up website
and click generate and Copy everything and Buddhas over here.
Okay.
And how we can move inside the template module.
I don't want to use something like process dot env okay.
Another one that we call this is the Next.js.
I will use similar.
Theme with this thing.
up module.
Now if you remember right here is the module we will configuration with the async.
And we use the use factory.
And we import and inject right.
I want you similar with that.
Now if you face it a little bit you can see we have a register asset.
Right.
And let me go.
And we also have a yield factory right.
We also have a factory similar with this thing.
Let me move this outside over here.
And let me copy everything from yield boost over here.
And we will invoke the config service.
And let me boost everything over here.
Right.
And let's do that.
Cigarettes will be coffee service dot get.
With the.
Cigarettes and sign in option also.
And we need to inject.
With epoch and in inject okay.
Don't forget that.
Okay.
So that is after here.
Let's check.
the terminal.
It's already successfully started.
Right.
Is that also.
Wait.
Let me show you how we can generate a template.
Right here.
Let's read the documentation.
If you scroll down a bit, you will say in order to generate the template, we can size with the asynchronous
operation.
And we need to go to my log.
We may.
Save user.
Dot.
Underscore.
Name.
So user dot name and email.
So we would write over here.
We don't need to bother option anymore because we already configured.
Okay.
After here we will.
Return us all.
And if you would like that is the old controller is still not work because right here we already wrapped
everything inside the nested object.
Right?
Let me test that.
Here we go.
Here.
Is that here?
I will click on send and you can see the message will be success, but it doesn't have any data.
Let me show you how we can fix that.
Let's open the chart from DTO.
Right here we have data, right.
Let me console.log for you.
What is the data?
And let me tell you that the error here will be the object.
It will have a save user and access token because we already returned us over here, right?
Now you can see it has a user and access token.
We need to configure it a little bit.
Now let me show you what is strategy right now.
I will check if the current URL will be the authentication.
Okay.
We need to return the data dot user over here.
Okay.
And we will put the access token over here.
Right.
Let me show you.
Firstly if you remember we have a context.
I will give the context.
Now switching to S3 and I will get the request right here.
And if we console log request dot this will be the And right now let me just console.log the path over
here.
I will say.
Now you can say we already got the path.
Okay, let me fix that.
Let me pull it over here.
It has generated okay.
So right here you can put directly the request from spread.
Okay.
So we invoke that from express okay.
We will switch it into the academy and get request from spreadsheet.
And this will fix that issue.
Request bus over here.
Okay.
And.
Average app is open, click on the URL.
I will just ask request.
Dot.
In close.
I will check it.
Include the out okay.
It will become true.
So right here I will check if, uh authentication passed.
I will return with the return over here.
Over here.
I will return the data and access token.
Data access token?
Right here is half.
And over here.
Alrighty, now we just need to ignore us.
Because we don't have any way to know what exactly the data.
Okay, so I think we can ignore the TypeScript.
Let me show you.
So here, let me sign up.
Okay.
We only got access token, but the data is still doesn't have right here.
We need to save user.
Okay.
Let me say it again.
Okay.
We already got a message like that.
And we also got the access token.
Very good.
Let me try to fix the script over here.
It's a little bit annoying right inside.
Here.
Let me, uh, let me rechartering the saved user and access token.
Okay.
And right here I will put the say user and access token directly over here.
Okay.
It will fix a little bit.
Right.
It will doesn't have any error.
Okay.
This will work.
And so that's for the video.
And I will see you in the next one.