Implement JWT token in Angular 14| Interceptors in Angular | Guards in Angular | Part 7

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024
  • Hello Viewers,
    This is the sixth part of the complete authentication and authorization in angular 14 + .net 6 project
    In this video, we will cover how to implement JWT Token in Angular with Auth guard and Inteceptor. This is a step-by-step video so do follow all the steps.
    Upcoming (Part 8): In part 8 will cover the role-based access and display the name from the Token payload
    Make sure to Give it a star on Githhub:
    github.com/ysh...
    github.com/ysh...
    Connect with me on the below Social links:
    RUclips: / @letsprogram30
    Instagram: / lets.program
    LinkedIn: / sashikumar-yadav-93b62...
    Telegram: t.me/letsprogr...
    Twitter: / yshashi30
    Important Links used in Video:
    Bootstrap: getbootstrap.com/
    Fontawesome4: fontawesome.co...
    Angular 14 Login and Signup Page | Part 1
    • Angular 14 Login and S...
    Angular 14 Form Validation| Part 2
    • Angular 14 Reactive Fo...
    Login & Signup API creation & integration with Angular | Part 3
    • Login and Signup using...
    Encrypt Password in .NET 6 | Password strength checker in Angular
    • Encrypt Password in .N...
    Angular News Application
    • Angular 14 News Applic...
    Crypto Currency Application
    • Angular Project - Cryp...
    Angular TODO Application
    • TODO Application in An...
    Angular 13 CRUD using Material UI
    • Angular 13 CRUD with A...
    Angular QUIZ Application
    • Angular 12 Quiz Applic...
    Angular Add-to-cart app
    • Add to Cart in Angular...
    #angular #angularlogin#angularsignup#angularproject #webapi #dotnet #dotnetcore #angulartraining #html #css #bootstrap #password #security #jwt #jwttoken #security #webdevelopment #netcoremvc

Комментарии • 160

  • @gauravpathak560
    @gauravpathak560 Год назад +6

    Hello Shashi, Thanks for your videos . It really a great contribution for us. I urge u please complete this series and continue make such a knowledgeable content as much as possible. Lot of love and support from us. Keep it up.

    • @letsprogram30
      @letsprogram30  Год назад +1

      tomorrow morning 9:30am IST and this Sunday we will do youtube live to complete the series

  • @ReadLineAcademy
    @ReadLineAcademy 7 месяцев назад

    you are my best teacher vaia
    So much easier approach ❤️❤️❤️
    Take love and go ahead inshahallah

    • @letsprogram30
      @letsprogram30  7 месяцев назад

      Thanks you so much, means a lot❤️

  • @gilmarsantossilva4332
    @gilmarsantossilva4332 Год назад +1

    Your videos are great, I'm learning a lot with them, thank you

  • @pilaniawebtutorials
    @pilaniawebtutorials Год назад +3

    Congratulations for 12k subs and your way to teach people is very easy , compact and knowledgeable and you deliver what they exactly need.
    Thanks and go ahead,
    Best wishes & regards
    Chaudhary Honey Pilania

  • @ameyashinde423
    @ameyashinde423 Год назад

    Nicely explained about interceptors and guards,

  • @vishnumanimala9546
    @vishnumanimala9546 Год назад

    hi bro. Thank god I found your videos. Thanks for explaining things so clearly.

  • @yovanies2798
    @yovanies2798 Год назад

    Excelente curso, estoy suscrito a tus videos. totalmente satisfecho y la espera de los siguientes videos. saludos desde Lima - Perú

  • @denis-gd1xc
    @denis-gd1xc Год назад

    thank you so much, i have a final college projct and this was the part i was the most afraid of but with youre tutorial its was easy!!

  • @akshaydaundkar1417
    @akshaydaundkar1417 Год назад

    Great Learning , Great Teacher
    Shashi is cool

  • @shamlazunjare6342
    @shamlazunjare6342 7 месяцев назад

    your explanation is too good 😊

  • @Daniel.Jimenez.
    @Daniel.Jimenez. 8 месяцев назад

    Great video. Thanks

  • @linhnghiem943
    @linhnghiem943 Год назад

    very details video !!! you are awesome teacher

  • @scottmacintyre7385
    @scottmacintyre7385 Год назад +1

    Great tutorial! Thanks for explaining things so clearly. One thing that happened to me when I changed the tokenDescriptor Expires interval in the backend api controller to AddSeconds(10), I got a 500 error. To fix this I changed it to use the UTC time (because of my time zone) - Expires = DateTime.UtcNow.AddSeconds(10).

    • @techies1
      @techies1 Год назад

      You can also watch this video for interceptors
      Angular http interceptors
      ruclips.net/video/cCS4STE-sXo/видео.html

    • @BolsaCast365
      @BolsaCast365 Год назад

      I had the same problem and couldn't solve it until I saw your post....thanks!

  • @ReadLineAcademy
    @ReadLineAcademy 7 месяцев назад

    sir . i am your big fan sir from bangladesh

    • @letsprogram30
      @letsprogram30  7 месяцев назад

      Thanks man!
      Love from India ❤️

    • @ReadLineAcademy
      @ReadLineAcademy 7 месяцев назад

      @@letsprogram30 ❤️❤️❤️❤️❤️❤️

  • @Mohan-jx1md
    @Mohan-jx1md Год назад

    Good job bro, keep it up, jai hind

  • @artick134
    @artick134 9 месяцев назад

    great video brother! keep going with good content!

  • @JogadorNm10
    @JogadorNm10 7 месяцев назад

    Great Job

  • @kmahendra6691
    @kmahendra6691 6 месяцев назад

    Best video ever 🤟🤟🤟🤟🤟🤟🤟🤟

  • @yazi-creations
    @yazi-creations Год назад

    Thanks a lot sir..!!!

  • @montassarmeddeb6979
    @montassarmeddeb6979 Год назад

    Thanks very much this is very helpful you made a great job brother

  • @luisfernandodeolazabalsche3317

    Super video, muchas gracias ;-)

  • @younesszgr3162
    @younesszgr3162 8 месяцев назад

    the best i swear !

  • @didi1172
    @didi1172 Год назад +2

    If you have a problem with 401 error response, even though you did everything right, check if the UseAuthentication() method is above UseAuthorization() in Program.cs. It helped for me :)

    • @letsprogram30
      @letsprogram30  Год назад

      Good job🙂

    • @ganeshpaandurekha
      @ganeshpaandurekha Год назад

      @@letsprogram30 I got 401 error bro. Everything is ok but only this 401 error i got. How to resolve?

    • @lollieli
      @lollieli Год назад

      @@ganeshpaandurekha have you managed to fix this?

    • @essaalshehada2762
      @essaalshehada2762 Год назад

      @@ganeshpaandurekha check if the UseAuthentication() method is above UseAuthorization() in Program.cs. It helped for me :)

    • @essaalshehada2762
      @essaalshehada2762 Год назад

      It helped for me :) too

  • @alagarkarthik2346
    @alagarkarthik2346 7 месяцев назад

    Hi Shashi, Nice Video. Could you please upload videos for Role based Jwt Authentication
    Create User Page | / User Login Page. After logged 1.Admin should have Dashboard, Product, Category, Settings page, 2.Manager have Dashboard, Product, Category page, 3.Reviewer should have Product, Category page Using .NETcore 6 EFCore and Angular 14.

  • @pritompaul4249
    @pritompaul4249 Год назад

    Brother please make a series on Identity server and angular.

  • @quyennguyenthe7231
    @quyennguyenthe7231 Год назад +1

    Great lesson! But 'CanActivate' is deprecated. I hope you can show me how to solve this problem. thanks

  • @JohnCena-ch3lc
    @JohnCena-ch3lc Год назад +2

    Hi Sashi. Thanks for the helpful video. I am unable to get the usernames in the dashboard page. So far I have followed everything in the video. When I went to the network to investigate, I found my Authorization header with bearer with myToken value as well. But status code still 401 pl help

    • @sbusisiwe_mkh5081
      @sbusisiwe_mkh5081 Год назад +1

      I also have that same issue. Did you figure it out eventually?

    • @shad4you
      @shad4you Год назад

      I was also getting the same, As I have gone through Interceptor concept- Interceptor call first url then. I debug the code then understood. I missed return keyword, thats the reason, I was getting undefined and It was not setting the Authorization header and 401 error. Solution:
      getToken(){
      return sessionStorage.getItem('token');// return keyword is required
      }

    • @WiseSteps.D
      @WiseSteps.D Год назад +1

      @@shad4you i tried this too dude, Are u able to help me

  • @prajwalsraj4089
    @prajwalsraj4089 Год назад

    Hello Shashi, Thanks for your videos. Waiting for part 8.. when can we expect

  • @MithileshPandey-gb4xw
    @MithileshPandey-gb4xw 3 месяца назад

    Excellent explanantion i need the code for backned and angular both..for prtacising perspuse

  • @khumeren7079
    @khumeren7079 Год назад +1

    Hi, CanActivate() is depreciated, could you release a refactored version of this video? Thank you, also keep going bro great content

    • @AravindanJ-je9ln
      @AravindanJ-je9ln Год назад

      I also not able to use canActivate and it's shows that depreciated, so do you have any idea for that? Please help me!

    • @payaladhikary4845
      @payaladhikary4845 Год назад

      Search in stack overflow, I also used the same for solution to this problem.

    • @ritwikgupta7540
      @ritwikgupta7540 10 месяцев назад

      You can use the CanActivate method in the same way, just inject the services using inject() method, and use that to call the authservice methods

  • @sureshb0122
    @sureshb0122 8 месяцев назад

    Hi shashi, I have angular 16 version in my machine , but that canActivate is not there, how do we implement it in canActivateFn ..?

  • @rishiraj2548
    @rishiraj2548 Год назад

    Good day greetings

  • @younesszgr3162
    @younesszgr3162 8 месяцев назад

    you rock

  • @surajkumarshukla681
    @surajkumarshukla681 Год назад +1

    Hi, can you make video on whole crud api call with behaviour subjects in service file and reuse it in other components and update data in behavior subject in case of edit or delete. You have made that crud app in angular 13 many extend that to use BehaviourSubject.

    • @letsprogram30
      @letsprogram30  Год назад

      Tomorrow the part 8 video will be out at 9:30am IST
      I have covered about behavior Subject

  • @neelshah1588
    @neelshah1588 Год назад

    really need this series completed so can use source code in my project as myself have typed but lots of error so now cant check each line starting from login bootstrap

  • @ivanasing6297
    @ivanasing6297 Год назад

    Hi Shashi
    Thank you for the amazing videos(as usual)
    Will we be dong the "forgot password" functionality to complete the user login page?
    The knowledge I have learnt from creating this project has been exceptional

    • @letsprogram30
      @letsprogram30  Год назад +1

      Tomorrow the part 8 video will be out at 9:30am IST
      The forget password will be covered in part 11, after Social Login.
      Till that time stay tuned and keep learning! ;)

  • @importanthaikya
    @importanthaikya Год назад

    Thanks sir for explaining things so clearly .
    But after every 5sec pop up of subscribe is too frustrating

    • @letsprogram30
      @letsprogram30  Год назад +1

      I’m sorry for the inconvenience, actually this video was recorded during my live session and forget to remove that annoying subscribe popup

    • @importanthaikya
      @importanthaikya Год назад

      @@letsprogram30 Ok sir!

  • @Sciencewithprerna
    @Sciencewithprerna Год назад

    Hi bhaiya! Can I use MongoDb for database rather than SQL??

  • @govindsingh_13
    @govindsingh_13 9 месяцев назад +1

    res.token gives error like Property 'token' does not exist on type 'Object'.

  • @jubina21
    @jubina21 Год назад

    👍

  • @sabrimariem6392
    @sabrimariem6392 Год назад

    thankss

  • @viratsharma1540
    @viratsharma1540 Год назад

    HI
    in isLoggedIn you are just checking if token is present or not. so we can bypass by creating token with random value in localstorage
    is any other to validate the token to protect the routes?

    • @letsprogram30
      @letsprogram30  Год назад

      Hello,
      I have explained the token way just to make understand the basic of auth guard implementation for the beginners.
      If you don’t want to use it then create a api in backend which check for permissions or user islogged in our not.
      Based on the you can return true or false.

  • @kanimozhi2433
    @kanimozhi2433 8 месяцев назад

    canActivate guard is now depricated , whether it works or not

  • @waleedshah692
    @waleedshah692 8 месяцев назад

    Greate video indeed but i faced one problem the inceptopr is working fine but now when i login with wrong password the error message is not showing. why is that?

    • @letsprogram30
      @letsprogram30  8 месяцев назад

      Check for the error in the log and add it to the toast message accordingly

  • @lil9icey886
    @lil9icey886 Год назад

    sir when i generated my guard its different from yours maybe its a different version

  • @wiggvns
    @wiggvns 4 месяца назад

    I am on the newest version of Angular and I cannot get this to work. The authorization parameter is not even getting sent in the Request Headers section of the Network console. Perhaps this is because app.module.ts is not longer included in the newest version. I put the providers in the main.ts file instead, but this did not work. Please help!

    • @letsprogram30
      @letsprogram30  4 месяца назад

      DM me on insta let’s fix it together

    • @wiggvns
      @wiggvns 4 месяца назад

      @@letsprogram30 Thanks! Just sent you a DM.

  • @narendranunna7663
    @narendranunna7663 Год назад

    Hi bro when will you upload the next continuation video

    • @letsprogram30
      @letsprogram30  Год назад

      Tomorrow the part 8 video will be out at 9:30am IST
      Sorry for kept you'll waiting.
      The wait will be worth ;)

  • @orhn
    @orhn Год назад

    Good video but please remove the subscribe popup or make it so it doesnt show up 30 times in a minute

    • @letsprogram30
      @letsprogram30  Год назад +1

      Sorry this video was covered in the live session so not able to remove that popup

  • @MithileshPandey-gb4xw
    @MithileshPandey-gb4xw Месяц назад

    how to implement intercepter with HttpInterceptorFn in angular 18 ...

  • @rashmitakamble5843
    @rashmitakamble5843 Год назад

    Hello Shashi, I'm getting this error ------Www-Authenticate:
    Bearer error="invalid_token", error_description="The signature key was not found"--------- after adding -- `Bearer ${myToken}`.

    • @WiseSteps.D
      @WiseSteps.D Год назад

      for me also bro, are u solved it?

  • @Vamsibatchu-jz1lk
    @Vamsibatchu-jz1lk Год назад

    I can generate the token and store it in the local storage as well but hen implementing auth guard I can go to the dashboard page can you help me with that?

  • @charanpallenti5711
    @charanpallenti5711 Год назад

    Hi when will you post the next video?

    • @letsprogram30
      @letsprogram30  Год назад

      Tomorrow the part 8 video will be out at 9:30am IST
      Till that time stay tuned and keep learning! ;)

  • @carpenter1carpenter2
    @carpenter1carpenter2 Год назад

    Can we send the token in the headers without using interceptors

    • @jamisonr
      @jamisonr Год назад

      No, I do not believe that is possible.

  • @aziziwalid-sd9kg
    @aziziwalid-sd9kg Год назад

    thank you for this tutorial and continuation
    how to fix this error
    return throwError(()=> new Error("Some other error occured"))

    • @letsprogram30
      @letsprogram30  Год назад

      This is not error, we have to throw error if there is something wrong in the api call

    • @waleedshah692
      @waleedshah692 8 месяцев назад

      @@letsprogram30 Brother now when wrong password enter the error of wrong login username is not displayed

  • @kasimpeera9380
    @kasimpeera9380 Год назад

    after adding route the path will not generated in app.routingmodule

  • @MithileshPandey-gb4xw
    @MithileshPandey-gb4xw Месяц назад

    i am implementing same code in angular 18 ...but getting excpetion ....local storage is not defined

    • @letsprogram30
      @letsprogram30  Месяц назад

      @@MithileshPandey-gb4xw the reason being you have select SSR during creating new application. And in SSR based application you cannot use window objects. So local storage won’t wrong on the reload of the page

    • @MithileshPandey-gb4xw
      @MithileshPandey-gb4xw Месяц назад

      @@letsprogram30 thnaks to reply.....please can you guide me how to relsolve this?

    • @letsprogram30
      @letsprogram30  Месяц назад

      @@MithileshPandey-gb4xw for the time being try to convert your SSR application to CSR.

  • @JayaPrakash-nn8jk
    @JayaPrakash-nn8jk Год назад

    Hey When i am creating Guards it is giving an error like canActivate is deprecated

    • @letsprogram30
      @letsprogram30  Год назад

      This blog might help you to fix it
      letsprogram.in/blog/647998365960050b58aca538

  • @iyanakazanova
    @iyanakazanova Год назад

    Could you please the link to github repo which contains the code of this series?

    • @letsprogram30
      @letsprogram30  Год назад

      Will be released after last part of the video

  • @lil9icey886
    @lil9icey886 Год назад

    how do i go about it then

  • @terabyte289
    @terabyte289 Год назад

    My token is not expiring what may be the cause

  • @deepakmoningi
    @deepakmoningi Год назад

    After using bearer in interceptor.ts file also getting 401 response bro Plzz help 😢😢

    • @letsprogram30
      @letsprogram30  Год назад

      DM me on Instagram

    • @crashie9604
      @crashie9604 Год назад

      Did you get an answer to this? im having the same issue and i dont have instagram...

    • @letsprogram30
      @letsprogram30  Год назад

      @@crashie9604 please check tokenhandlerparameters

  • @kasimpeera9380
    @kasimpeera9380 Год назад

    sir i have a small doubt

  • @kasimpeera9380
    @kasimpeera9380 Год назад

    i dont understand can you give me the clarity about that

  • @AravindanJ-je9ln
    @AravindanJ-je9ln Год назад

    canActivate is deprecated how to use

    • @letsprogram30
      @letsprogram30  Год назад

      Will come up with a video soon to showcase the new feature of angular to fix this issue!

  • @ReadLineAcademy
    @ReadLineAcademy 7 месяцев назад

    21:31 minute sir canactivate deprecated how can i implement this

    • @letsprogram30
      @letsprogram30  7 месяцев назад

      Make use of functional router guards now you can find a blog on my website blog.letsprogram.in

    • @ReadLineAcademy
      @ReadLineAcademy 7 месяцев назад

      @@letsprogram30 ok sir

    • @ReadLineAcademy
      @ReadLineAcademy 7 месяцев назад

      @@letsprogram30 i use this previously but get an error sir
      X [ERROR] TS2339: Property 'isLoggedIn' does not exist on type 'AuthService'. [plugin angular-compiler]

  • @sharanteja3517
    @sharanteja3517 Год назад

    bro iam facing 401 error while Authourizing through the token

  • @ShamilBadalov-iu3uq
    @ShamilBadalov-iu3uq Год назад

    I really appreciate the video, but it annoys me that the "subscribe" button just appears every 10 seconds. This made it impossible for me to watch videos for longer than ten minutes. Because I didn't want to be distracted by such things in later videos, I decided not to subscribe as a result. Although I can see the marketing strategy, it would be better if it appeared every ten or so minutes. Cheers.

  • @jayakumar2927
    @jayakumar2927 Год назад

    ​how to secure JWT Tokens?

  • @BuyRak-rf1gp
    @BuyRak-rf1gp Год назад +1

    Hi bro, you show very often button "Subscribed", it`s not good...)

    • @letsprogram30
      @letsprogram30  Год назад +1

      I’m sorry, actually this video was created during a live session and not able to edit that footer of subscribe.
      Sorry for inconvenience

  • @kajakarthikeya
    @kajakarthikeya Год назад +1

    Please remove that subscribe popup on the video. its very irritating, and also i am not able to see the video clearly

  • @verushkan
    @verushkan 5 месяцев назад

    You`ve added too much subscribe notifications...

    • @letsprogram30
      @letsprogram30  4 месяца назад

      Sorry about that, this video was part of a live stream. I have made sure not to do such popup thing again!
      Thanks for understanding!

  • @abdulhai_007
    @abdulhai_007 Год назад

    Ur request to subscribe is annoying like anything!!!
    Can u pls remove it from..
    Keep it at the beginning, end, or may once/twice in middle…but it’s coming like anything in middle of the video

    • @letsprogram30
      @letsprogram30  Год назад

      Sorry for the inconvenience bro, I have removed it from other videos

  • @Jhonessmile
    @Jhonessmile 3 месяца назад

    Like & subscribe is blocking the tutorial content,

    • @letsprogram30
      @letsprogram30  3 месяца назад

      I’m so sorry for the inconvenience

  • @mdkarimul8923
    @mdkarimul8923 8 месяцев назад

    Right now more things happened with ai in 😢Jan 2024

    • @letsprogram30
      @letsprogram30  8 месяцев назад +1

      Yes I agree, we can use it to save our most of the time 😊 But make sure to understand what we are getting from the AI. I will never recommend doing direct copy and paste. If you know the concept then there is no harm in using AI
      Cheers 🥂

  • @henrik3098
    @henrik3098 Год назад

    bro stop showing that popup all the time

  • @locthiennguyen
    @locthiennguyen Год назад

    thank you sir, i was wondering how to attach stuff to request header without having to modify all the REST request in my service file, your Interceptors solve everythings, great work sir

  • @yaswanthpodapati1828
    @yaswanthpodapati1828 9 месяцев назад

    But 'CanActivate' is deprecated. What can i do that time ?

    • @letsprogram30
      @letsprogram30  9 месяцев назад

      Use the same logic but wrap it inside a functional router guard

  • @kajakarthikeya
    @kajakarthikeya Год назад +1

    Please remove that subscribe popup on the video. its very irritating, and also i am not able to see the video clearly