Generating JWT Tokens | ASP.NET 6 REST API Following CLEAN ARCHITECTURE & DDD Tutorial | Part 2

Поділитися
Вставка
  • Опубліковано 25 сер 2024
  • Link to the full playlist: • ASP.NET 6 REST API Fol...
    Become a Patreon & get the source code: / amantinband
    Follow me on 'em socials:
    Twitter: / amantinband
    LinkedIn: / amantinband
    GitHub: github.com/ama...
    What is this series?
    We'll build a REST API following Clean Architecture & Domain-Driven Design principles completely from scratch.
    We will use .NET 6, EF Core, and common patterns such as CQRS, unit of work, repository, mediator, and more 💪🏽
    We'll also use some awesome open-source libraries such as MediatR, FluentValidation, ErrorOr, Throw, Mapster, and more.
    The developing environment will be visual studio code & dotnet CLI only. We will use awesome vscode plugins for everything from sending HTTP requests to connecting to our SQL database, debugging, and peeking at JWT tokens.
    We will code and refactor multiple times to tackle the many concepts I want to teach. When the series will be over, you'll have a good understanding and intuition on how to use these patterns & libraries in your industry-level applications.
    How often will a new part come out?
    Once or twice a week.
    What are we doing today?
    We'll create a JWT token generator & use the "Options Pattern" to retrieve the values from the appsettings. We'll then remove the secret and use the "dotnet user-secrets" feature to store our secrets instead.
    After this video, you should have a better understanding of the application vs infrastructure layer and what goes where 💪🏽
    Do you love hidden gems? Well, if you do and use vscode, you're in for a treat!
    #dotnet

КОМЕНТАРІ • 150

  • @MilanJovanovicTech
    @MilanJovanovicTech 2 роки тому +59

    Really great mention of using user secrets during development. I think people don't sanitize their sensitive configuration information when committing code.
    I've been guilty of this myself until I learned the proper way to do it.

  • @bogdanb904
    @bogdanb904 2 роки тому +34

    Hands down, the best tutorial on the topic I've found so far!

  • @NK-xw4uu
    @NK-xw4uu 2 роки тому +12

    You have made the concepts so simple, usually devs don't understand this even after years of experience

    • @amantinband
      @amantinband  2 роки тому

      Thanks NK! I appreciate your kind words🙏

  • @mahditalebi1770
    @mahditalebi1770 Рік тому +1

    Thank you for this series. It's really great. no bullshit, no extra explanation, just straight to the point and to the code. I really love it. keep doing this!
    Before watching this I was doing clean architecture a different way but I realize I was making a huge mistake and even though it was not really hurting us badly, it could hurt us one day. But this also increased my confidence as I realised I was doing a lot of things right! Thanks a lot for this course and this series. Best of luck to you in the future mate.

  • @kmcdo
    @kmcdo 2 роки тому +3

    I'm really enjoying this series and I love and use the clean architecture organization in nearly all my projects. One thing I've started doing that I offer as a suggestion to you, is making the Infrastructure implementations internal so that the presentation layer can't accidentally use them directly. Only the Dependency Injection class is public to facilitate DI registration.

    • @amantinband
      @amantinband  2 роки тому +4

      Thanks Kyle, really happy to hear! I'm planning a video with a few tricks we can do to avoid having infra details leak into the presentation layer. public -> internal is one of them. I won't say the rest cuz it's a spoiler 😁

    • @kmcdo
      @kmcdo 2 роки тому

      @@amantinband how exciting! very interested to hear other such tricks :-)

  • @chidieberelevi3344
    @chidieberelevi3344 2 роки тому +2

    This is the real deal. Thanks for taking your time to do this 🙌

    • @amantinband
      @amantinband  2 роки тому +1

      You're welcome, I enjoy making them 😁

  • @zhangyi5145
    @zhangyi5145 2 роки тому

    the best tutorial I've ever seen in terms of clean architecture & DDD, downloaded and might reference to it several times, thank you sir.

  • @afsanehhazeghi8890
    @afsanehhazeghi8890 2 роки тому

    to me, this was the best video that I've ever seen, I`m eager to see your upcoming videos asap. specially thanks for using user-secrets which makes this video more practical.

    • @amantinband
      @amantinband  2 роки тому +1

      Best comment I could get. Thanks, Afsaneh 🤙

  • @elhelalyQ
    @elhelalyQ 2 роки тому +1

    One of the most tutorials I have ever seen, thank you 🙏🏻

  • @stickyamp5996
    @stickyamp5996 2 місяці тому

    You are actually a good teacher. Thanks

  • @imryoko
    @imryoko Рік тому

    This is my first time lerning about clean architechture and my mind is swirling already. will try to let the logic and code sync in

  • @damiansocha4056
    @damiansocha4056 Рік тому

    after finisihing the first part... that is exactly what i needed... The only thing i do different is using visual studio and all different class library projects, but with very small changes all works perfectly... Thanks

  • @abhishekbagchi6052
    @abhishekbagchi6052 2 роки тому +1

    I will be waiting here till the next one comes.. no pressure 🙃🙃

  • @Marko-the-Beast-Master
    @Marko-the-Beast-Master Рік тому +3

    the problem is, that is all so much quick and I'm just blindly copying code without knowing what I'm doing or why.

  • @DanielTames
    @DanielTames 2 роки тому

    Wow Amichai!
    you are an amazing teacher or content creator, the explanation of the steps and the knowhow is incredible!
    Ty very much and keep going ✔✔❤❤

  • @karolniedziela3658
    @karolniedziela3658 2 роки тому +1

    I can't wait to see how this channel will grow in the near future

  • @MaheshSingh-ev8yh
    @MaheshSingh-ev8yh 10 місяців тому

    Thanks Amichai Mantinband. Really appreciates work explanation and approach. it's very insightful.

  • @405192802
    @405192802 Рік тому

    Great videos, I just want to build a restapi service with authentication, but can not find other tutorials, however these videos helped me!

  • @susantamaji2941
    @susantamaji2941 Рік тому +1

    Please add refresh token and O auth authentication video on this series.

  • @patrykk.4630
    @patrykk.4630 2 роки тому +3

    Thanks for this course. It's just second video, I can't wait for more. Keep doing great job 💪
    Great speed in videos. You aren't too slow, as some other UA-camrs are. Good explanations of the code.
    One note, I think you should discuss or just share your VS Code extensions, if you can. Sometimes I was a little confused - "what? How?" 😀

    • @amantinband
      @amantinband  2 роки тому +2

      Thanks Patryk, I'm really happy to hear! I think I covered all the extensions I use (other than vim which is a series of its own 😁). What were you curios about?

    • @patrykk.4630
      @patrykk.4630 2 роки тому

      @@amantinband do you have any extension for something like 'auto using statements' and for namespaces? I think I don't have that function in my VSCcode. Or am I wrong?

    • @amantinband
      @amantinband  2 роки тому +4

      Whoops I completely forgot to talk about all these must have extensions. I think my next video will be all about vscode for .NET developers, where I'll cover all the extensions I love and a few configurations which make life much easier 🙂

    • @patrykk.4630
      @patrykk.4630 2 роки тому +1

      @@amantinband it would be great 🙂 not every developer uses VSCode every day 😀

  • @youtube.com-handle
    @youtube.com-handle 2 роки тому

    very useful, easy to follow series
    tip for those who are used to use the visual studio; like myself, the vs 2022 have the rest client, and the jwt tools; substitute for the jwt decoder, plugins which work just like their vscode counterparts.
    once again, thanks for the series.

  • @acd2377
    @acd2377 Рік тому +2

    Why do we need the IDateTimeProvider? I can't see any benefits of this abstraction. The interface has a property named "UtcNow" and the implementation returns, as expected, a UtcNow.
    I believe you know what you are doing. But it would be great if you could provide some rationale on this decision.

  • @ignatnikitin6666
    @ignatnikitin6666 2 роки тому +2

    Great video! I guess it could be a bit better to have some more details in case you do something different in some places for example why JwtSettings is a class and not a record as another models

  • @ghevisartor6005
    @ghevisartor6005 Рік тому

    Jesus this videos has 1k likes and literally 0 dislikes unless the chrome extension is broken, anyway thank you for this amazing video.
    Wow working in vscode with those convenient extensions can be a lot of fun.

  • @rajansinghrawat7667
    @rajansinghrawat7667 2 роки тому +1

    Excellent article. I request can you please also create a step by step document. It will be very helpful. Thank you very much for your effort to elaborate Clean architecture & DDD.

  • @Yupieln
    @Yupieln 2 роки тому

    The way I understood your explanation in the beginning was that the Infrastructure layer can only depend on the application layer for information, yet in this video you use the Domain model in the Infrastructure layer, which shouldn't be since it doesn't depend on the Domain layer.

    • @amantinband
      @amantinband  2 роки тому

      Perhaps I could have been clearer. Outer layers can use inner layers. You could also reference the Domain layer directly from the infrastructure layer if you'd like

    • @Yupieln
      @Yupieln 2 роки тому

      @@amantinband I see. Thank you for that reply.

  • @ashrafuzzamanshahriar7701
    @ashrafuzzamanshahriar7701 2 роки тому

    Superb series please continue.

  • @yurayg1
    @yurayg1 2 роки тому

    Very good tutorial!. I found many useful tips for using dotnet cli.

  • @alexwexov4298
    @alexwexov4298 2 роки тому

    Amazing videos, very high quality. Thanks and keep up the great work.

  • @tesszheng4586
    @tesszheng4586 Рік тому +2

    Hi Amichai, thanks for creating this amazing video, can I know what extensions you have installed that give you these amazing autoCompletion and quick refactor options?

  • @talkathiriify
    @talkathiriify 6 місяців тому

    Excellent
    Thank you so much.

  • @mahmudx
    @mahmudx 2 роки тому

    Can't wait for the next video.

  • @liordagan5098
    @liordagan5098 2 роки тому +2

    22:21 you’re very welcome 🤣🤪❤️

  • @tirodev
    @tirodev 2 роки тому

    Thanks for sharing. All videos were amazing.

  • @fadygamilmahrousmasoud5863
    @fadygamilmahrousmasoud5863 2 роки тому

    waiting for part 3, thank you ❤

  • @DaminGamerMC
    @DaminGamerMC 2 роки тому

    Github copilot knows so much

  • @tiagojosedasilvavieira7072
    @tiagojosedasilvavieira7072 Рік тому +2

    Could you please tell me why you built the token generator feature in the infrastructure layer instead of just creating a separate service in the application service layer? Thank you.

    • @chenyuhwu
      @chenyuhwu 5 місяців тому

      You have the same question as mine.

  • @ibnfpv
    @ibnfpv 2 роки тому

    Great video man!
    Keep up the great work

  • @diegodario1400
    @diegodario1400 Рік тому

    You're awesome, thank you for sharing.

  • @fadidib8516
    @fadidib8516 2 роки тому

    great series, thank you for explaining.

  • @LieberLois
    @LieberLois 11 місяців тому

    Love the series so far, great didactic skills! :)
    By the way, do you have the Miro Board (or whatever you're using for the architecture documentation) uploaded somewhere? Would love to add that to my notes!

  • @yos2413
    @yos2413 Рік тому

    Awesome content thanks!! It would be really helpful if you could do a video on event sourcing..

  • @AS-zj4jv
    @AS-zj4jv Рік тому +1

    Quick question - what is the reasoning behind putting the interface in the application layer and the implementation in the Infrastructure layer?

    • @mlegault18
      @mlegault18 10 місяців тому

      The idea is to put the interfaces close to the part of your code that consume it... application layer in this case.

  • @mastra1055
    @mastra1055 2 місяці тому

    I'm using the same super-secret-key but when I try to run the register request, it throw an exception saying
    > Unable to create KeyedHashAlgorithm for algorithm 'HS256', the key size must be greater than: '256' bits, key has '128' bits. (Parameter 'keyBytes')
    I understand the error but I don't understand why it works in the video
    Anyway thank you so much, high quality content!

  • @unhandledexception1948
    @unhandledexception1948 Місяць тому

    great series.... btw I can't seem to see all these refactorings in vs code, although I did install rosylnator and enabled refactorings.... are u using another extension ?

  • @megaxzero88
    @megaxzero88 2 роки тому +1

    1. Love how you have a graphical view of the UI/architecture. What do you use to create that?
    2. Could you make a video on how you navigate through vscode so fast? Some examples are how you easily bounce between explorer and editor and delete whole word from editor
    Thanks!

    • @amantinband
      @amantinband  2 роки тому +7

      Great to hear. I create all the visuals in figma.
      Most of the code navigation tricks are done with the vim plugin. Since I've been getting many questions about it, I think my next video will be all about vscode extensions for .NET developers

    • @megaxzero88
      @megaxzero88 2 роки тому

      @@amantinband awesome. Thanks and it'll be much appreciated

  • @hamzaahmad6741
    @hamzaahmad6741 Рік тому

    Best Video for understanding Clean Architecture via implementation.
    I want to know which extension or anything you are using for the intelligence of code.

    • @amantinband
      @amantinband  Рік тому

      I have a video all about vscode for .NET development: ua-cam.com/video/m9HvsB1-hAo/v-deo.html

  • @aaronhevenstone9697
    @aaronhevenstone9697 2 роки тому +1

    Thanks for these incredible tutorials. I look forward to continue following along! I was wondering if you could provide some more info on why creating a date time provider is necessary/preferred. I use DateTimeOffset in almost all my projects, but I've never pulled it out into it's own provider before.

    • @amantinband
      @amantinband  2 роки тому +3

      If you use DateTimeOffset then for unit tests. When using DateTime it can also help enforce using UTC only

  • @danielbocharnikov7872
    @danielbocharnikov7872 2 роки тому

    Thank you for your work!

  • @nellya4676
    @nellya4676 3 місяці тому

    Hello, Thank you for this training. I do have a question related to JWT implementation. I still don't understand why the JWT implementation needs to be added in the Infrastructure Layer rather than the Application Layer (as a service). Is this a type of constraint?

  • @subhajitroy5940
    @subhajitroy5940 2 роки тому

    Absolutely helpful ❤️

  • @bingbing8156
    @bingbing8156 20 днів тому

    At first, thanks so much for this video. Could you share the name of the extensions that you used in VS Code, it looks so powerful to suggest and help develop quickly. is it any AI tools or not?

  • @GaurabChatterjee
    @GaurabChatterjee 2 роки тому +2

    I need to know the vs code extension that suggests while you are coding. Please :)

    • @amantinband
      @amantinband  2 роки тому +1

      Check out my latest video 😉

  • @Yash42189
    @Yash42189 Рік тому

    why is the auth service not implemented in infrastructure? Great playlist btw.

  • @user-qo7mq3qn8k
    @user-qo7mq3qn8k 8 місяців тому

    Should Authentication process be a concern of Application or API? Because JWT seems like a web API specific implementation. What if I want to use Application on an async messaging context instead of REST or GraphQL?

  • @aisonjackmendoza7709
    @aisonjackmendoza7709 Рік тому

    Thank youuuuu so muuuuuch!

  • @creightonchingarande7542
    @creightonchingarande7542 7 місяців тому

    if you get security key issue please increase key

  • @offthepathworks9171
    @offthepathworks9171 Рік тому

    Not 100% sure, maybe it's my error, but sometimes before minute 10 mark, when we are making additions to BuberDinner.Infrastructure.Authentication DependencyInjection file, it was non-empty, I mean we had services.AddScoped for a different interface.

  • @user-sg4kw8uh3m
    @user-sg4kw8uh3m Рік тому

    Thank you very much!

  • @anandhapadmanaban7051
    @anandhapadmanaban7051 Рік тому

    Hi Amichai, Why do we have the Authentication Service implementation in the Application project but not in the Infrastructure project?

  • @ibrahim-SO
    @ibrahim-SO Рік тому

    Hi, i would really like to see if you can implement identity server on this project on a different video maybe? I keep rewatching this series to implement stuff to my project that i learnt from you.
    My english is kinda bad, sory for typos.

  • @mohammedabdelwahab9773
    @mohammedabdelwahab9773 Рік тому +1

    Great work, but your elocution is very fast, and I have to slow down the video speed, which affects the sound quality

  • @joaovitorbarbosa4669
    @joaovitorbarbosa4669 Рік тому

    Why is the IJwtTokenGenerator interface at the application layer? Shouldn't it be in the infrastructure layer?

  • @tidianediallo6199
    @tidianediallo6199 2 роки тому

    Great professor. Thanks'

  • @howto9279
    @howto9279 Рік тому

    Aaaand YES! Good job! (=

  • @no-name2031
    @no-name2031 Рік тому +1

    10:11
    Why? What value does that add to anything? I don't understand why you created a singleton that encapsulates/ adds a layer of abstaction to one line of code "DateTime.utcnow;"
    It would make sense if you would do something constant all over that application with that serviceprovider, let's say add 60 minutes ( and in the future you want to change that to 30 for whatever reason ) but the client still controls how much time to add to utcnow timestamp.
    So again, why?

  • @OneStopMusic.
    @OneStopMusic. 2 роки тому

    Hi, can you make a video on the basics of jwt

  • @renejeanrugaba4234
    @renejeanrugaba4234 Рік тому

    you have this error ==> 'IServiceCollection' does not contain a definition for 'Configuration' even though IntelliSense suggests otherwise
    add this nuget package ==> "Microsoft.Extensions.Options.ConfigurationExtensions"

  • @aprilthirteen7557
    @aprilthirteen7557 Рік тому

    Thanks for this great video. I wanna ask about usign UTC Date times. In generally we can use UTC times in our web api, not only in jwt. So should consumers (SPA or Mobile) of our api convert all dates to local date time?

  • @ryoman76
    @ryoman76 2 роки тому

    best idea using secret!!! but how to publish the secrets?

  • @hackerw2
    @hackerw2 10 місяців тому

    hey thanks for this amazing video, quick question: how do you draw those arrows and rectangles so fast? is there any particular programs you use?

  • @IAmIndraTheGod
    @IAmIndraTheGod Рік тому

    Hi, what extensions do you use in vscode for dotnet development ?

  • @goodwillsoftwares1900
    @goodwillsoftwares1900 2 роки тому

    Till now very classic.
    Have got one Q: How do we separate this into a microservice design? , coz I see the infrastructure and application the dependencies are being injected.

    • @amantinband
      @amantinband  2 роки тому

      Thanks, perhaps in the end of the series I'll demonstrate how the service can be split via different methodologies (i.e. Modular Monolith, Microservices etc')

  • @kenrazo2533
    @kenrazo2533 2 роки тому

    this is good shit!

  • @systemsatyaki
    @systemsatyaki Рік тому

    is it possible without EF can we design DDD in dot.net core?

  • @bilal-elmursi
    @bilal-elmursi 2 роки тому

    Thank You!

  • @alhassenbrini7649
    @alhassenbrini7649 Рік тому

    Hello ,
    move to the second video,
    I really want how to get the auto-completed or auto-generated code like you do work with intellisense and autogenerated line of codes.
    Thank you.

    • @amantinband
      @amantinband  Рік тому

      Hey, I have a video all about setting up vscode for .NET: ua-cam.com/video/m9HvsB1-hAo/v-deo.html

  • @arthurfedotiew3609
    @arthurfedotiew3609 Рік тому

    Amichai, thank you so so much for such a valuable content!!
    i've got one question though... Why have you put IJwtTokenGenerator inside Common-->Interfaces-->Authentication instead of Authentication folder at the top level of Application layer? Is IJwtTokenGenerator going to be used in contexts other than Authentication one? I am new to .Net truth to be told, but have been building client side with angular for a while using DDD, and as far as I understand Common is like Shared, isn't it? Do we have to reduce Common to the minimum only put there 'code entities' sparingly in case we really need to reuse 'em across domains? At least that what I have been doing on FE side..)

  • @hamzaghabashneh1007
    @hamzaghabashneh1007 Рік тому

    at 4:05
    what is name of extension that generate code for such as which happened in 4:05 ?
    thank you for tutorial , it is really awesome

  • @madcoins5906
    @madcoins5906 2 роки тому +1

    Great video's! What piece of software do you use to create those diagrams/images? Also curious what you use to box and point during your explanations?! Thank you!

    • @amantinband
      @amantinband  2 роки тому +5

      Thanks! All the visuals are created in figma. For drawing on the screen I use ZoomIt. I first saw it used by Scott Hanselman, he has a few videos talking about it if you want to learn more

  • @pbayat6667
    @pbayat6667 2 роки тому

    You Are Amazing

  • @RyptHunterz
    @RyptHunterz Рік тому

    Why use 'SectionName' when there's nameof()?

  • @juke-duke
    @juke-duke 2 роки тому +2

    Are you going to be using entityframework core?

  • @ramapullaguntla725
    @ramapullaguntla725 2 роки тому

    Thanks for the great video.. I have a small question, why not put the IJwtTokenGenerator in the "Infrastructure" project instead of "Application" project ?

    • @amantinband
      @amantinband  Рік тому +1

      In Clean Architecture, "infra" concerns are declared and used via interfaces defined in the application layer. The actual implementation sits in the infra layer.
      If the interface was defined in the infra layer, it couldn't be used by the application layer since it doesn't reference it

  • @nivaldobrasil
    @nivaldobrasil 2 роки тому

    thank you

  • @aldrichlim2743
    @aldrichlim2743 Рік тому

    Do you have the list of extensions that you are using? I've used Visual Studio but I'm new in using Visual Studio Code and the recommendations that appear when you type does not appear on my Visual Studio Code. It's a bit hard without that recommendation setting

  • @jrobertoaraujo
    @jrobertoaraujo 2 роки тому +1

    Hi, what’s the extension you’re using that is helping you to have this kind of auto-complete like this?

    • @amantinband
      @amantinband  2 роки тому +3

      GitHub Co-Pilot. But beware, it's hard to go back 🤓

  • @SteveNgaiCheeWeng
    @SteveNgaiCheeWeng 2 роки тому

    Hi Amichai Mantinband, thanks for the great tutorial. May I know how you get the auto code suggestion in VS Code?

    • @NaveenKumar-hd7mp
      @NaveenKumar-hd7mp 2 роки тому

      Good question. I was curious about this

    • @amantinband
      @amantinband  2 роки тому

      The suggestions are coming from the GitHub Co-Pilot extension

  • @kholosso1
    @kholosso1 2 роки тому

    Are you going to make some unit or integration tests for the project?

  • @vamvdotnet
    @vamvdotnet 2 роки тому

    Hello Amichai! Nice video!
    I have a question: what VSCode extension are you using to launch the http requests, if you be so kind?
    Thank you!

    • @amantinband
      @amantinband  2 роки тому +3

      Hey Cristiano, I'm using the REST Client extension. I actually have a video about setting up vscode for .NET:
      ua-cam.com/video/m9HvsB1-hAo/v-deo.html

  • @oleksandrbelen9903
    @oleksandrbelen9903 2 роки тому

    Thanks a lot, very useful.
    Can you please tell which extensions you have on VS Code?

    • @amantinband
      @amantinband  2 роки тому +1

      I think my next video will be all about vscode for .NET developers. I'll cover tips, tricks and all the extensions I use 🙂

    • @oleksandrbelen9903
      @oleksandrbelen9903 2 роки тому

      I'm looking forward to it :)

  • @mahdimollaeian8840
    @mahdimollaeian8840 2 роки тому

    Great

  • @alvinfebriando
    @alvinfebriando Рік тому

    In min 17:36, what extension do you used to have wrap parameter options?

    • @amantinband
      @amantinband  Рік тому

      Not sure which extension it comes from, perhaps roslynator. I have a video all about setting up vscode for dotnet development. Check it out!

  • @vincentbui8380
    @vincentbui8380 2 роки тому

    what extensions are you using that is allowing you to do the injection to create the constructor?

    • @lionsito1466
      @lionsito1466 Рік тому

      I belive this is from the default visual studio

  • @jesusdicent2
    @jesusdicent2 2 роки тому

    How did you hide the bin and obj folders

    • @amantinband
      @amantinband  2 роки тому +1

      I have a video about setting up vscode for .NET in which I cover this (the link will take you to the correct place in the video):
      ua-cam.com/video/m9HvsB1-hAo/v-deo.html

  • @Fr4zn2pirit
    @Fr4zn2pirit 2 роки тому

    What is the program you're using for the visuals at the beginning?

    • @amantinband
      @amantinband  2 роки тому +1

      All the visuals are created in figma

  • @danzzel
    @danzzel 7 місяців тому +2

    Too fast speaking. Not enough clear explanations.

  • @Servellia
    @Servellia 2 роки тому

    JWT is short for (J)SON (W)eb (T)oken. If you name something JwtTokenGenerator, I'm reading this as "Json web token token generator". It doesn't affect functionality, but it makes my eyelid twitch.
    Other then that, great content. Especially the user-secrets part.

    • @amantinband
      @amantinband  2 роки тому +1

      Haha yeah that's a good point. That's what happens to me when I see a variable named jwtToken. Perhaps JwtGenerator would be a better name

  • @ThiagoZeroUm
    @ThiagoZeroUm 11 місяців тому +1

    shouldn't the secret be twice as big? When I use "super-secret-key" as secret I get an error saying that hmacsha256 needs 256 bits while my key has 128. How do you not get this error?

    • @Sergueio
      @Sergueio 8 місяців тому

      I'm using .NET 8 and had the same problem.

    • @Sergueio
      @Sergueio 8 місяців тому

      Found it! Replace "super-secret-key" for a longer string, not less than 40 characters and it works like charm.

    • @shadmansudipto7287
      @shadmansudipto7287 3 місяці тому

      @@Sergueio 8 bits per character, so you need 32 characters.

  • @noobyetdope4208
    @noobyetdope4208 2 роки тому +1

    Absolutely amazing tutoria..One quick question what is the need to use dateTimeProvider when the there is a method in DateTime.UtcNow.AddMinutes(60);
    I just needed a little clarification on this..Really appreciate the content you are providing

    • @amantinband
      @amantinband  2 роки тому +1

      It allows mocking the date & time in unit tests and can help enforce using UTC date time