Laravel vuejs Passport Scope Based Auth VueRouter Vuex and Laravel 6 SPA Login to an account

so now if we go to login that view same thing we have to do here so let's give it a name first data 10 and here we go user this time we will need only empty and [Music] arrows object also sound like this and here this was just [Music] okay and this is I remember me check so [Music] and even need to change this function same way gesture and you will have to do strike edge also here so here we will have to get the response faster so constant response okay we also need to import same service you and said thought we will have to make another service here here let's just copy this bastard here and this will be register sorry login and we check here so here authentic again and we are getting the user and make a post request here ok this is fine this and effy of the arrows so let's see whatever we are getting we have one and this one is called status code and the bouncer support zero one and also for 22 for this for the one for this so let's copy this the first statement wrong I'll register and you just answered here so we have this okay this is mine this it's or is it one okay and and all the other one we are what we are returning okay this is a message reminded wised the spirit important right and with it okay this and we will get this one response okay and for this I think we should have some kind of I love here oh okay but we can [Music] message okay these are fine now let's save this and and here we will clear this and if we click on login so it's again okay we just need to be told there's nothing else okay so now where's this remove this browser validation again login and I think is happening you click again no okay we have errors in our console Wow today's status camera ok what is problem and BL okay let's consult dog what this content okay it says that user is not defined because we need this also here there's the Lotus correct we are getting there here validation errors but we just need to display it let each text box okay so that just remove a spot here error was this one okay we will help write this here okay now if we go to register we have the same these because the objects have seen everything from Sam's of this way and this one here come here reload let me click here yeah we are getting that the email password so if you give something like this I'd say okay we are getting a mess if they come to doors I'm late remember me okay we have passing a budget should be like balls and we have to connect this this and still one two three that's so so the window just click Hakan we're getting data and the data content the user and also the exes token and token tie everything here okay every click on today's remember me and then click them okay see the expiry date is how is all it was this 2020 and it's 2018 ok so everything looks correct we have now two more order so I'm here here we will just need to go to the phone okay and now it will just move the user we can also create this this will move the user to the home okay because in home we have these are but we will need to store this access token in our local storage and also we can store the user data and also these information we can store so let's come back here and here inside our service we have this login method what we have to modify a little bit this like here and say doctor this one we can make you can do some of things here 10 plus response and state response may be a response here we can get a status code from this because if we look here we are unsuccessful we have a status code of 200 ok so we can check all day like response job status times a week 200 then here we will need to store tokens so what we can do we can use locals to a start we have to set item so local select our set item and set item required to things from us when is a key maybe and the second one as the object we are storing things we are storing here so this it give it or we can give it a total sample and here we will have to use gesture 25 and then the token we can get it round data data this is fine like this okay and then we was returned the channel [Music] okay then this is correct and also if you don't like to store all these information and here like the name and these email these stops you don't want to store this in the browser and you can do something else oh this like we will need to call every time and API to get the user information page road but for now I will just here so this is fine and okay this is correct if we go to our application and I pretty load this we go to the boom we can go to home because if you see it last time we have given some this thing is we are doing this thing so this is not good for the other pages like categories and - code and home so let's do this here oh I said that here we will just give it right back so if we have a login this fake door this is my wife correct okay and okay now close this and here and set the login okay this is fine but if you look here we can go easily to home page without anything without any restriction so this for some instruction on this to go to voucher and I mean here we will have to use some middle bear here inside all this out should be completely protected should become a cliche cavern by has two three like to form an X parameter and here like false here we go need to have odd [Music] so we have this then we have to return okay so I've token s here then it will degenerate whether to return now we have to check this now here if our tart is Robin because we already imported this so it will check that and if it is false then we have to bring back the user to the login page otherwise we will okay let's hear the Lord you're going to do login here and everybody will try again like I just run plug-in let me try again yeah okay and also we cannot go to your home and then it is because of the router not secured so what we have to do here inside all the gesture no not registered let's just hope this ends our login okay we are now moving this here and we are storing the token you know local storage looks good that's justice this also P inspect and you go towards application and said here [Music] okay every click login you got this you're getting a few counts to come these things okay I think it's the problem of this we are giving again the same part like if it is not love them then okay but if it is not the end then we don't need to give it again now and we will give it up next because we are already giving this here and the next of the fine let's try again like welcome please and yes this is fine yeah now you know whole page so everything looks good now but if you look you can see here we have complete data against user and the name email and all these terms and I just don't like to have this kind of data here but instead of this I just want to have one string we can call it a token so we can use any package for this to encrypt this data and then decrypt whenever we are sending some requests to get this token in all this user data and we only need to have this access token part of our API request but another for other purposes we will need to help this data also like if we want to display a user first name out here like the name here and also the emails from you like no idear section we will read in future so let's use some some kind of package to encrypt this all data and one token okay so for this we go to the search for jason web token alright 24:20 MJ's calm and if you search here and this is an exact match okay and we can use this can be used for many purposes but for now we will just used to encrypt all of this data so we have to copy this terminal here on this take some time it is a large table and now we have to use it so inside you're also missing something for this okay and now once we are storing the our token to the local storage now we have to end clip this token here so how can we do that we can move we can first make our variable some kind of like token and if you look here this user object complete of this tested here so this will encrypt this okay and here this is a sacred sacred team so here you can use some kind of hash okay so I will just use you okay this is fine so now we will have to store this here didn't understand this thank you now you have to delete this look from here you okay okay clear then you reload and you can do that I prosecute the login because it opens come on here okay if you see here now this is they token we encrypt it okay so this is this look much better than before is and everything looks correct okay there sit for the bonus tutorial in the next tutorial we will work on the logout and also we will make these round secure because if we look here and say our particular controller there is no security and we look to a PHP so these to get these were just a test I'm going to be able to secure this one by giving a giving at the cell middleware here and we will use our Sam same way of check the took on the scope and we have these we just need to apply this on this one and to make it secure so let's see do these in the next tutorial

Loading