1 00:00:00,750 --> 00:00:06,509 well in this video we are going to continue working with the touch that we created in the previous point 2 00:00:06,509 --> 00:00:13,050 we stayed in this code ok here we used the jason web token to create with the point 3 00:00:13,050 --> 00:00:18,190 yes to sign it digitally create that touch and we sent it to 4 00:00:21,789 --> 00:00:27,410 the front if there was no error if there was any error what we did was to visualize 5 00:00:27,410 --> 00:00:34,130 through the console.log that error, okay, we did this through the callback that 6 00:00:34,130 --> 00:00:43,009 provides us with the function of jasonwebtoken.sync, okay, remember that we passed the field to jasonwebtoken 7 00:00:43,009 --> 00:00:50,789 on which we wanted to build that token and encrypt it, we passed a password that 8 00:00:50,789 --> 00:00:56,689 could be a public or private password, we passed some options that in our case 9 00:00:56,689 --> 00:01:05,069 I only passed the time of expiration that I have put in a day the callback and it was worth the 10 00:01:05,069 --> 00:01:16,150 callback to receive that error or that touch is worth created is worth then now what we want to 11 00:01:16,150 --> 00:01:24,150 to do this is not to send a json with the touch what we want is to send a 12 00:01:26,609 --> 00:01:30,549 a cookie is worth then to send that cookie 13 00:01:33,530 --> 00:01:41,769 we can do it from the pack that is, we send the rest.cookie and the value of that cookie that in the 14 00:01:41,769 --> 00:01:49,450 front is going to generate that cookie we could also send it this touch is worth and then from the front 15 00:01:49,450 --> 00:01:58,090 collect it collect that information and already in us create a variable or create a cookie that would be 16 00:01:58,090 --> 00:02:04,250 more cumbersome and it is the cleanest code if you send it directly from the park and you create that 17 00:02:04,250 --> 00:02:11,750 cookie in the front is worth then to do that what we are going to do is put a point here 18 00:02:13,710 --> 00:02:23,639 cookie ok and to this to this function to the rest point cookie what happens to it are two 19 00:02:23,639 --> 00:02:28,080 parameters for what you have here the name and the value the name 20 00:02:28,080 --> 00:02:38,280 is a string so here the name because we are going to put it because for example touch is worth and the 21 00:02:38,280 --> 00:02:49,370 value separated by a comma is going to be because it is going to be the touch is worth in this way we are creating it 22 00:02:49,370 --> 00:02:58,629 we are creating that cookie is worth we can also send it in addition to creating that cookie 23 00:02:58,629 --> 00:03:06,789 well, so that we also get a message in the body of the front, not something that indicates to the 24 00:03:06,789 --> 00:03:13,270 client that the cookie has been created, we are going to put a dot res on it, we could put a 25 00:03:13,270 --> 00:03:20,870 send on it, we are going to put a json on it, especially because in the end we are all the time working 26 00:03:20,870 --> 00:03:30,110 as others are, because we are going to use a json in which we are going to pass a key that is 27 00:03:30,110 --> 00:03:36,620 message and we are going to pass a value that is going to be the 28 00:03:39,020 --> 00:03:44,740 no this is not the error because here it would have been created satisfactorily because it is already 29 00:03:44,740 --> 00:03:53,979 well that user created correctly or satisfactorily as you want correctly 30 00:03:56,539 --> 00:04:04,620 ok and it would be with this it will already work for us it does not give us any correct you see that in 31 00:04:04,620 --> 00:04:12,740 any error you see that here the server is all right, no demon is not telling us that there is 32 00:04:12,740 --> 00:04:20,199 no problem we are going to try it we have everything raised you know 33 00:04:20,199 --> 00:04:26,040 we have mongo mongo express raised raised servers we have our 34 00:04:26,040 --> 00:04:31,899 database with the different values ​​we are going to 35 00:04:31,899 --> 00:04:38,620 create from the thunder from the client from our front we are going to launch this 36 00:04:38,620 --> 00:04:44,399 that we had that we did in the last video ok that was carmen in the mail it was carmen 37 00:04:44,399 --> 00:04:55,060 at 2.com 134 ok we send it ok this is all good if we send it ok then now 38 00:04:55,060 --> 00:05:07,079 we have not missed any error the network that we have put has been the network.json the user message 39 00:05:07,079 --> 00:05:17,579 correctly created and tells us it receives the from ss json with the message key and then the user 40 00:05:17,579 --> 00:05:23,800 created correctly, that is, this has put us well and also if you look up here we have 41 00:05:23,800 --> 00:05:30,300 in addition to the response we have the guides of the cookies the results docs is worth in the guides that 42 00:05:30,300 --> 00:05:38,100 the information that accompanies or that we can the heads of the information with which we can 43 00:05:38,100 --> 00:05:45,360 work there is one that is the set cookie and in the set cookie it has created the touch for us, it has created the 44 00:05:45,360 --> 00:05:55,100 touch, it has put all this touch here, which is what we have told it from this line, it has 45 00:05:55,100 --> 00:06:01,939 put the cookie, sorry, the token and if we go to cookies we see that we have the cookie 46 00:06:01,939 --> 00:06:14,699 touch ok and here we have that that that touch if we trust this touch we come to 47 00:06:14,699 --> 00:06:35,939 jw t.io what we talked about the other day in the last video ok let's go here we are going to paste 48 00:06:35,939 --> 00:06:53,709 our touch control v we see that the idea is 669 25 c ok we go back here and we are going to see that the one that has 49 00:06:53,709 --> 00:07:07,589 created us is 669 25 c ok so everything is fine now we have everything working well everything 50 00:07:07,589 --> 00:07:12,649 where we have reached, but if we are creating a cookie, we are 51 00:07:12,649 --> 00:07:19,189 sending the json well from the front to the backend and from the backend to the front, we are using 52 00:07:19,189 --> 00:07:28,990 the json web token that as I told you, you use it a lot later in the tfg, well here I call it jwt 53 00:07:28,990 --> 00:07:38,170 when we import it, okay, we are using that callback that allows me to play with the 54 00:07:38,170 --> 00:07:46,449 right or the error, okay, you are playing, you are playing with the arrow functions, there are already 55 00:07:46,449 --> 00:07:52,850 several things that you are doing, okay, and so far everything is working for us, okay, 56 00:07:52,850 --> 00:07:58,970 So now what I want to do is place a little bit of all this code. 57 00:07:59,629 --> 00:08:01,910 Okay, so this code. 58 00:08:03,910 --> 00:08:14,569 This code and well, I'm going to modify this later, too, because in the end here we are sending a error message through the console, through the terminal, if 59 00:08:14,569 --> 00:08:22,970 some error occurs but instead of this his thing is to send the client an error code 60 00:08:22,970 --> 00:08:28,610 ok then I will do that later now what I want is to optimize a little or think a little about 61 00:08:28,610 --> 00:08:41,129 this piece is worth this function jw point without ok then first that function well there we do 62 00:08:41,129 --> 00:08:48,409 varias cosas y lo suyo es que sea síncrono vale siempre que podemos entrar en algún tipo de 63 00:08:48,409 --> 00:08:56,750 conflicto de una manera más o menos fácil y eso pararía nuestro desarrollo lo suyo siempre es 64 00:08:56,750 --> 00:09:07,789 utilizar las funciones vale asíncronas entonces por un lado vamos a pensar cómo hacer esto 65 00:09:07,789 --> 00:09:15,710 asynchronous on the other hand we are generating a touch but of course we are generating it only in the 66 00:09:15,710 --> 00:09:26,809 register function ok then that touch if the user is already registered and exists you have to create it 67 00:09:28,149 --> 00:09:34,350 also in the login function ok then we cannot forget we are playing the register all the 68 00:09:34,350 --> 00:09:41,669 time the register then we will touch the login but we cannot forget then this piece 69 00:09:41,669 --> 00:09:51,590 is worth this portion of code we could take it and come and paste it here and like god but you 70 00:09:51,590 --> 00:09:59,610 are programmers and you are asked to work as programmers then you already know that one of the 71 00:09:59,610 --> 00:10:10,169 characteristics that the code has to have in the reuse of code when we are going to 72 00:10:10,169 --> 00:10:18,129 use it varies in many places we have several times his thing is to be able to export it and call 73 00:10:18,129 --> 00:10:24,870 that code every time we need it not to be copying all the time which would lead us 74 00:10:24,870 --> 00:10:31,570 to a very serious code inconsistency and that in addition any programmer who sees 75 00:10:31,570 --> 00:10:38,309 your code what he understands is that you do not know how to program, it is worth apart from going crazy because you 76 00:10:38,309 --> 00:10:43,710 multiply the code, it is worth it, you make it much bigger and much less clean, so we have to 77 00:10:43,710 --> 00:10:50,429 get this to be cleaner, it is worth a bit like we are doing now that I am creating 78 00:10:50,429 --> 00:10:56,009 constant all the time variables that then I call the variables well and we are 79 00:10:56,009 --> 00:11:03,210 ordering it in this way ok then we are going to go step by step for example we are going to start with 80 00:11:03,210 --> 00:11:11,289 this of the password the key not the key on the one hand you cannot put it 81 00:11:13,970 --> 00:11:19,710 like this because anyone who gets into your code will see it quickly then well 82 00:11:19,710 --> 00:11:28,409 maybe here it would be good apart from using a type of public and private key instead of only one 83 00:11:28,409 --> 00:11:42,159 ok but we could to organize it a little we are going to make a field that we are going to call it because 84 00:11:42,159 --> 00:11:51,360 the secret touch or secret word or whatever you want ok then to do this we could 85 00:11:51,360 --> 00:12:02,039 and within that recent I am going to create a file that I am going to call config.js for example it is worth 86 00:12:02,039 --> 00:12:08,580 config.js configuration.js then here I am going to save because that is what 87 00:12:08,580 --> 00:12:16,440 would be values ​​of this type values ​​that are variables or that are constant and that I am going to 88 00:12:16,440 --> 00:12:23,879 have access to them from any part of my development through the name of that 89 00:12:23,879 --> 00:12:30,240 variable not through the value which makes it a little safer ok then what am I going to 90 00:12:30,240 --> 00:12:42,279 create here because a constant that as I tell you we can call it password or as you 91 00:12:42,279 --> 00:12:46,600 you want, it is worth the best, it is usually used always when it is for the touch 92 00:12:48,240 --> 00:12:53,240 the touch as it was this low password 93 00:12:55,879 --> 00:13:08,399 secret touch in low secret okay this is the same and here I pass the password for example 94 00:13:08,399 --> 00:13:21,440 we are going to put the course dam 2-2024 for example, it is worth the one that you want, so I 95 00:13:21,440 --> 00:13:31,000 have this cost this variable touch in secret I have the value the seed that I am going to use to be able to 96 00:13:31,000 --> 00:13:36,320 then encrypt that touch then if I come now to the out controller I import 97 00:13:38,500 --> 00:13:39,340 and import 98 00:13:41,779 --> 00:13:45,399 we have called it 99 00:13:53,669 --> 00:14:08,620 touch in secret it is worth touch in under secret from and here we are going to put it 100 00:14:08,620 --> 00:14:18,279 config.js is worth remembering the js is worth and then what am I going to do to pass it here 101 00:14:18,279 --> 00:14:25,500 instead of this field it is worth this string we are going to pass the touch it is 102 00:14:27,059 --> 00:14:35,379 good so it is no longer the same that you are seeing the code all the time although well the only thing 103 00:14:35,379 --> 00:14:39,820 that I have done has been to move it here as well as at the security level it is not a very 104 00:14:39,820 --> 00:14:48,879 spectacular thing either or well it can be a nonsense but if you order it if we can call that key from 105 00:14:48,879 --> 00:14:56,279 different sites and be able to change that key only by making a change in config.js it is worth 106 00:14:56,279 --> 00:15:03,659 for it to affect the rest of the javascript files for this on the one hand now on the other hand 107 00:15:03,659 --> 00:15:10,480 because we have said that this is this portion of code we are going to call it from different 108 00:15:10,480 --> 00:15:17,700 sites then I am going to take this portion we are going to create ourselves in lips that for that we have 109 00:15:17,700 --> 00:15:25,259 a new file ok we are going to create a new file that we are going to call it for example because 110 00:15:25,259 --> 00:15:35,700 Since we are with the JSON Web Token, we are with the JWT, we are going to call it JWT.javascript. 111 00:15:35,700 --> 00:15:49,860 And within this JS file, we are going to create a function that I am going to export later, 112 00:15:49,860 --> 00:15:58,080 so we are going to put the sport function, okay, we are going to call this function, well, 113 00:16:02,100 --> 00:16:16,399 create access, create access, touch access, touch access, okay, a classic function that will have its 114 00:16:16,399 --> 00:16:24,700 retun that will have its stories, it is a classic function in this function I am going to and I am going to paste 115 00:16:24,700 --> 00:16:39,919 all this this code control x here control ok well the first thing here is going to give me a problem 116 00:16:39,919 --> 00:16:52,159 because JWT does not recognize it because I have not imported the jasonwebtoken, okay, then import JWT from 117 00:16:55,419 --> 00:17:03,279 jasonwebtoken, now at least this part of the JWT 118 00:17:03,279 --> 00:17:14,380 because we are going to have it well, okay, that leads me to eliminate it from here, 119 00:17:15,519 --> 00:17:24,259 okay, I delete this and this instead of putting it here as I have taken it to jw t.js 120 00:17:24,259 --> 00:17:37,759 then control x and I'm going to take it to jwt point s ready ok ok then I keep looking at the jw 121 00:17:37,759 --> 00:17:47,019 testing in the jw s jason web token point without the first thing that happens to him is a field that is the 122 00:17:47,019 --> 00:17:53,420 idea that we are working on to generate the touch and then encrypt it ok then we can 123 00:17:53,420 --> 00:18:01,400 how we are going to pass an idea of ​​different users because every time a user is logged in, 124 00:18:01,400 --> 00:18:07,440 it will be created or we are going to use their ID, we are not going to use only one, it is worth to generate those 125 00:18:07,440 --> 00:18:15,299 touch because that information we have to pass it to this function then to this function 126 00:18:15,299 --> 00:18:21,980 we are going to pass that load value before if you look or if you remember when we were talking 127 00:18:21,980 --> 00:18:38,680 of jw we talked about that when the touch was created there were three three groups of numbers and letters 128 00:18:38,680 --> 00:18:46,799 separated by points some that were the header another that was the value load is worth the pilot and the 129 00:18:46,799 --> 00:18:55,039 other one that was the signature, so we saw that in the previous video, then what I pass that 130 00:18:55,039 --> 00:19:04,500 idea is worth that later jw t.io recognizes it as that load of value is worth looking at how 131 00:19:06,680 --> 00:19:12,519 here it is putting it with the pilot data is worth and it is here where I have this idea because 132 00:19:12,519 --> 00:19:24,039 because to follow a little the coherence with the names that json web token gives it or the technologies 133 00:19:24,039 --> 00:19:32,319 that we are using, we are going to tell it that I am going to pass an input parameter that is that 134 00:19:32,319 --> 00:19:39,779 idea and that input parameter I am going to call it because the father does it, the father does the value load 135 00:19:39,779 --> 00:19:49,259 and then in the jw t this first value that identifier is going to take it through the pay loat 136 00:19:51,960 --> 00:20:00,839 then I already modify the pay loat the touch in secret expires in a day ok well these 137 00:20:00,839 --> 00:20:09,460 options this res cookie j are this I am going to leave it to send it is worth this instead of putting it 138 00:20:09,460 --> 00:20:19,279 here I am going to put it in the out controller and I am going to put it here ok I am going to put it here 139 00:20:19,279 --> 00:20:27,500 because in the end what I want is good I am going to call that function ok so we are going to import it 140 00:20:27,500 --> 00:20:41,029 we are going to import it, we have called it to create access, it is worth it, then import, 141 00:20:42,750 --> 00:20:51,269 create access, it is worth it, there I have it, then here it is worth it after saving it, which is what 142 00:20:51,269 --> 00:20:57,150 we were doing where we had the jw function without what I am going to do is 143 00:21:02,809 --> 00:21:11,190 I still need this one, otherwise it will give me an error 144 00:21:11,190 --> 00:21:16,190 I probably left it here 145 00:21:16,190 --> 00:21:20,190 This is the one 146 00:21:20,190 --> 00:21:26,390 Yes, this one is over 147 00:21:26,390 --> 00:21:36,640 Here I would miss the key, I have not copied it well 148 00:21:36,640 --> 00:21:47,819 this would be here, this would be here and this would not be left over, now everything is fine, then what I was 149 00:21:47,819 --> 00:22:00,460 telling you is worth this value, this is from where it is from the jason web of the jason that we are sending it, 150 00:22:00,460 --> 00:22:11,779 vale esto ya está todo bien vale entonces sí aquí voy a llamar a esa función vale a la que estamos 151 00:22:11,779 --> 00:22:19,180 creando entonces la función primero la hemos importado crear acceso token vale entonces aquí 152 00:22:19,180 --> 00:22:27,759 le voy a llamar a crear acceso token le hemos dicho que le vamos a pasar un parámetro de entrada 153 00:22:27,759 --> 00:22:37,519 ok then that input parameter is going to be that field and it is ok then that field 154 00:22:39,259 --> 00:22:57,240 and we are going to put it in the mobile that field and I can't put the 6 directly 155 00:22:57,240 --> 00:23:05,099 lo que le voy a pasar es todo el jota son entonces lo pongo entre llaves le pongo el campo y de 156 00:23:06,359 --> 00:23:09,799 dos puntos y le ponemos él 157 00:23:12,140 --> 00:23:17,539 el 6 que es el usuario que hemos que ya hemos 158 00:23:17,539 --> 00:23:31,750 saved it is worth then we are going to use the user 6 user 6 point under and d 159 00:23:32,750 --> 00:23:45,170 in this way I am passing that identifier to the pilot to the payload and he is loading 160 00:23:45,170 --> 00:23:55,549 that identifier in the jw point yes ok and this would create it for us ok what else are we going to do well 161 00:23:55,549 --> 00:24:06,779 we are going to use a function ok because I need to return this I need to make a retun 162 00:24:08,660 --> 00:24:13,960 where I am making this call ok then as I want to make a retun 163 00:24:13,960 --> 00:24:22,339 I want this value that then I am going to put this touch in that this touch is the one that generated us 164 00:24:22,339 --> 00:24:29,799 the jw testing is worth that touch right now in this function does not exist that that value does not 165 00:24:29,799 --> 00:24:37,859 have to return it to create access then here I am going to create a touch and it is worth 166 00:24:37,859 --> 00:24:45,440 so that this does not give me an error ok and that means that this has to return us a challenge 167 00:24:45,440 --> 00:24:52,660 ok but this what we had was set if there is an error you do not show it by console and if there is 168 00:24:52,660 --> 00:25:01,039 no error then you send it to the front ok then this function I need to make a 169 00:25:01,039 --> 00:25:08,599 challenge then we are going to use some functions that are called promise that is promise is worth 170 00:25:09,720 --> 00:25:16,059 then these functions what they do is that they always return you an error or a 171 00:25:19,460 --> 00:25:26,799 created one or it does it well or it does it wrong it returns you only those two those two outputs 172 00:25:26,799 --> 00:25:36,099 it is valid or it is well done or it is badly done then to use those functions because we are going to put it 173 00:25:36,099 --> 00:25:51,109 or if the way to use them is no more, this is the function no more, it is worth and you see then it 174 00:25:51,109 --> 00:25:58,869 gives us a when this function is executed this type of function that is an arrow function gives us 175 00:25:58,869 --> 00:26:05,630 a result that is resolved that I did not get the word or a king that is a black one is worth 176 00:26:05,630 --> 00:26:20,000 then this will always have as input parameters a result or a network is worth and this 177 00:26:22,380 --> 00:26:29,220 is a type of function but more than it is a type of arrow function is worth then 178 00:26:29,220 --> 00:26:34,680 this 179 00:26:40,160 --> 00:26:47,460 then this is going to return a result or a rayet it is a type of arrow function 180 00:26:47,460 --> 00:26:51,680 so I'm going to take and I'm going to copy this 181 00:26:52,599 --> 00:26:55,240 control 182 00:26:55,559 --> 00:26:58,799 and this we are going to paste 183 00:26:58,799 --> 00:27:09,299 ok then this is like a pipe ok the jw t 184 00:27:09,299 --> 00:27:13,119 is going to give us back 185 00:27:13,380 --> 00:27:22,400 a touch or an error is worth it that is going to be if it is a touch it is going to pick it up 186 00:27:22,400 --> 00:27:31,279 promise in king sorry in resolve and if it is an error it will pick it up in king ok and that is 187 00:27:31,279 --> 00:27:40,519 what I am going to return then this we are going to put it with the challenge ok then the challenge is going to 188 00:27:40,519 --> 00:27:45,839 allow me to return this because I use the promise function because this one already makes me return these 189 00:27:45,839 --> 00:27:54,660 two options but it would have to or return an error or return a touch and that is not done, it is never worth 190 00:27:54,660 --> 00:28:02,000 putting two returns in one in one function that is one is a barbarity then we put the return we put 191 00:28:02,000 --> 00:28:10,839 the promise we play with the result or the king and that result or that king we are going to give it a value 192 00:28:10,839 --> 00:28:19,000 in the jwt point yes it is worth then here we would not change anything because we are with the jason 193 00:28:19,000 --> 00:28:28,000 web toque signing the identifier with a secret key and the only thing that we have passed is the option 194 00:28:28,000 --> 00:28:37,160 that it expires in a day ok and here if here we have an error it is worth the callback of the jwt 195 00:28:37,160 --> 00:28:44,519 point zinc which is the error and the touch in if there is an error then this now I do not tell you that 196 00:28:45,619 --> 00:28:54,480 a error is displayed for me by the terminal what I tell you is okay because if there is a 197 00:28:54,480 --> 00:29:03,859 error then king parenthesis is worth this is if there is an error but if there is no error and if he 198 00:29:03,859 --> 00:29:14,680 ha hecho todo bien entonces lo que le digo es un sol toque vale y esto lo que va a hacer es me vas 199 00:29:16,799 --> 00:29:28,119 o devolver en mi función o en mi variable token me vas a devolver un token o me vas a devolver 200 00:29:28,119 --> 00:29:38,440 an error ok and we have said that this function we said before this function that yours is 201 00:29:38,440 --> 00:29:49,240 asynchronous ok then we to make an asynchronous function man we do not do it we use 202 00:29:49,240 --> 00:29:55,599 the weight and the async but we do not do it on this function it is worth this type of classic functions 203 00:29:55,599 --> 00:30:02,740 for that we do it from the arrow functions and this is our arrow function that we already 204 00:30:02,740 --> 00:30:12,170 have here in the zinc as and therefore we can use a weight here and tell it to 205 00:30:12,170 --> 00:30:22,829 execute us in the background to create access to touch and we are already passing the 206 00:30:22,829 --> 00:30:33,910 pailo at the value load with the user 6 point under id ok ok and then we say this ok 207 00:30:33,910 --> 00:30:47,470 on the one hand you are going to create this variable that is because that is the cookie ok with the touch that we have 208 00:30:47,470 --> 00:30:54,970 created in creating access touch ok or yes and we also tell him to visualize us this is ok 209 00:30:57,289 --> 00:31:17,700 and if it were if there was any error then we can tell him we can visualize this or tell him 210 00:31:17,700 --> 00:31:25,740 because here what I do is the king but good is that I am not interested if there is any 211 00:31:25,740 --> 00:31:32,740 error that is when I am going to skip the cat what I am going to tell him is to send a state to the 212 00:31:32,740 --> 00:31:44,160 client to the client to the front then we are going to put the status network I am going to pass the 500 ok then if 213 00:31:44,160 --> 00:31:57,480 you are looking for the states that is a 500 is an execution error ok and here I am going to pass a json 214 00:31:59,440 --> 00:32:04,039 that I am going to put as always the keys that they do not always ask for 215 00:32:04,039 --> 00:32:22,450 2 points and here it is going to be the point ok I close the keys I close and that's it ok then we can do we can 216 00:32:22,450 --> 00:32:30,730 leave it like that and then everything should work correctly here it says that there is an error 217 00:32:30,730 --> 00:32:34,170 it failed in the index 218 00:32:42,700 --> 00:32:45,539 we are going to 219 00:32:45,859 --> 00:32:49,319 touch the secret from 220 00:32:51,660 --> 00:33:00,619 .js is worth where we are using this is in jw 221 00:33:00,619 --> 00:33:06,180 and here I tell you to go up one and it is in conflict 222 00:33:06,180 --> 00:33:10,980 I have not taken this, I do not know why, we are going to see 223 00:33:10,980 --> 00:33:38,700 import-secret-from-info-config.js 224 00:33:45,950 --> 00:33:50,089 ok let's see where that error is 225 00:33:50,089 --> 00:34:01,970 ok then the error comes from 226 00:34:01,970 --> 00:34:11,789 no le he puesto el sport vale entonces sport ahora sí debería de que está todo 227 00:34:11,789 --> 00:34:18,719 bien vale y ahora vamos a hacer nuestra prueba entonces tenemos 228 00:34:25,420 --> 00:34:29,940 vamos a eliminar al carmen 229 00:34:29,940 --> 00:34:45,349 so we are going to launch our from our client we send it this json so that 230 00:34:45,349 --> 00:34:51,909 everything works for us I give it to senf ok in the answer it tells us user created correctly 231 00:34:51,909 --> 00:34:59,289 we have not missed any error and if we come to the cookie we already have our cookie created it is worth 232 00:34:59,289 --> 00:35:06,429 the same as before, the header, we have everything, everything works for us well, this is the correct way 233 00:35:06,429 --> 00:35:14,909 to use the code to make it efficient to be able to use what will be from the controller because we will use 234 00:35:16,170 --> 00:35:26,610 that same function in login and place a little, it is worth organizing a little the whole code 235 00:35:26,610 --> 00:35:35,230 that we are using is all this we could remove it is worth this because the user created 236 00:35:35,230 --> 00:35:40,670 satisfactorily if you want instead of this now we could send them if you want 237 00:35:43,929 --> 00:35:51,769 we could send them the information as we did before, it is worth as you were 238 00:35:51,769 --> 00:36:00,550 wanting and what you are looking for is worth then with the network also look at how we send a 239 00:36:00,550 --> 00:36:08,329 6 to send a string a json to send a json a status to send a state is worth accompanied 240 00:36:08,329 --> 00:36:16,269 with a json is worth staying with all those ideas ok well until here a greeting see you later