Quickly Authenticate Users with FastAPI and Token Authentication

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.ย. 2024

ความคิดเห็น • 65

  • @DreamsAPI
    @DreamsAPI ปีที่แล้ว +6

    Thank you Tim for teaching and sharing.
    To all, study, take breaks, apply knowledge and understanding, keep learning, before you know it your understanding is increasing and becomes comprehensible overtime.

    • @BonyLenta
      @BonyLenta 9 หลายเดือนก่อน +1

      Thank you Tim for teaching and sharing. To all, study, take breaks, apply knowledge and understanding, keep learning, before you know it your understanding is increasing and becomes comprehensible overtime.

    • @obiotwastaken
      @obiotwastaken 6 หลายเดือนก่อน +1

      Thank you Tim for teaching and sharing. To all, study, take breaks, apply knowledge and understanding, keep learning, before you know it your understanding is increasing and becomes comprehensible overtime.

  • @Rabixter
    @Rabixter 6 หลายเดือนก่อน +7

    This is quite confusing to be honest. But I appreciate its the nature of the topic, not the fault of the video. Will probably need to watch this again.

  • @mohitashliya8750
    @mohitashliya8750 3 หลายเดือนก่อน +1

    Thanks man , All my doubts regarding the Basemodels and those 2 astrisks and OAuth2 are cleared here.

  • @octaverossi3428
    @octaverossi3428 3 หลายเดือนก่อน +1

    what a tutorial. Hats off for this one

  • @saurabhbasak9545
    @saurabhbasak9545 ปีที่แล้ว +7

    Is there a second part?

  • @TheSuloman20
    @TheSuloman20 10 หลายเดือนก่อน +2

    Awesome, but i need second part, where is it?

  • @vengtCent
    @vengtCent 8 หลายเดือนก่อน +1

    Thank you Tim for sharing your knowledge although it's fastt paced i could follow pretty good.
    It would be nice if you'd explain the code more extensively. For example why did you chose to make the functions get_current_user and get_current_active_user async?

  • @pradnyamane2619
    @pradnyamane2619 10 หลายเดือนก่อน

    Thanks for video, and line by line explanation .. helpful for the user, using the OAUTH for first time.

  • @DanielRodriguez-lu3uu
    @DanielRodriguez-lu3uu หลายเดือนก่อน +1

    It's kind of the same stuff you will find on FastAPI documentation. Real value would be to show the real flow with a login page, as that part is not that straight forward.

  • @BHAVESHMADHUSUDHANKARAPU
    @BHAVESHMADHUSUDHANKARAPU ปีที่แล้ว +2

    im getting an error of "'openssl' is not recognized as an internal or external command,
    operable program or batch file." while creating Secret Key

    • @AkamaiDeveloper
      @AkamaiDeveloper  ปีที่แล้ว +1

      It could be that 'openssl' is not installed on your system. If you're using a Windows machine, this post comment from GitHub may be useful:
      github.com/facebook/flipper/issues/3294#issuecomment-1014466972
      Alternatively, you can check out this Stack Exchange post for installation instructions on other Operating Systems:
      stackoverflow.com/questions/9001316/how-to-install-openssl-for-python

  • @gdefombelle
    @gdefombelle 3 หลายเดือนก่อน

    Fast but absolutely excellent

  • @Async_40_9
    @Async_40_9 ปีที่แล้ว +6

    For some this may be usefull, if you return an list and wnat to show it in docs response example, use response_model=list[schema] in api decorator. And with python 3.11 you do not need to use response_model var in api decorator but instead use function type hints as:
    async def my_func(…) -> list[schema]:
    FastAPI is the best :]

  • @joaovictor-dl6ve
    @joaovictor-dl6ve ปีที่แล้ว +1

    Is possible to create with Oauth a role and permission model similar to RBAC?

  • @soldadopreciso
    @soldadopreciso ปีที่แล้ว +1

    But is there some info of path login , logout, signup?

  • @randomforest_dev
    @randomforest_dev 10 หลายเดือนก่อน

    from what I previously understand, first user login with username and password from login form and gets jwt token, second user send that jwt token to protected api routes, middleware extract the token from header and check if it is valid or not and decides to continue or stop the request. But the logic in FastAPI is a bit complicated. why do I need to pass again the username and password to access every protected routes?

  • @guneetsingh1416
    @guneetsingh1416 8 หลายเดือนก่อน

    Is it possible not to give hardcoded db in the code, as its a senstive information.

  • @evam796
    @evam796 3 หลายเดือนก่อน

    This is all great but how come there isn’t a library that does most of this work for you ??

  • @user-ng4pk4tt3v
    @user-ng4pk4tt3v ปีที่แล้ว

    thank you very much

  • @danielstatler954
    @danielstatler954 ปีที่แล้ว +2

    got stuck on the openssl rannd -hex 32 bit. installed pyopenssl. pip list shows its installed. terminal says there is no such module. tried to add it to path but couldnt find the file for it.
    If i cant even follow a tutorial , should i just give up on programming? i swear to god nothing ever works when i try and do it

    • @nicofabregues
      @nicofabregues ปีที่แล้ว +4

      it´s part of the game my friend. I encourage you to keep going, but know that in order to be a programmer the most difficult task it is not how to code a complex method, but to know how to solve a problem. Cause everything its already made, we programmers only copy code from the web and make it work. Search your error, find an alternate path or ask for help, there is no other way than facing the problem and to keep trying for pointless hours until somehow it works, at first you re not going to understand how it happened, but as life keeps going it´s all going to start being easy and making sense

    • @AkamaiDeveloper
      @AkamaiDeveloper  ปีที่แล้ว +3

      Don't give up Daniel! The odds are that someone else has also had this same issue. This guide has instructions for troubleshooting "No module named 'OpenSSL' in Python":
      bobbyhadz.com/blog/python-no-module-named-openssl
      Also, if you need to find the file path for the command, you can use the 'which' command on a Linux system and the 'where' command on a Windows machine.
      superuser.com/questions/49104/how-do-i-find-the-location-of-an-executable-in-windows
      linuxize.com/post/linux-which-command/

  • @MrRobott88
    @MrRobott88 4 หลายเดือนก่อน +1

    Python not always is simple. PHP Sessions wins! 😂

  • @yungboiy5688
    @yungboiy5688 4 วันที่ผ่านมา

    followed the whole video and ended up with just getting Unauthorized errors

  • @drchastr208
    @drchastr208 ปีที่แล้ว

    I have facing a problem in line 98 where it says db is not defined I don't really see db written or defined in your code but I see that we have named it fake_db. so what is happening ?

    • @drchastr208
      @drchastr208 ปีที่แล้ว +1

      ok it seems it was some error in the code even in Tim's perspective he fixes it at time 41:42

    • @AkamaiDeveloper
      @AkamaiDeveloper  ปีที่แล้ว +1

      You can find the code for this tutorial in the techwithtim GitHub repo. You should be able cross reference your code with what is available here:
      github.com/techwithtim/Fast-API-Tutorial/blob/94c7e9ae19d45b8cdda7e068fe156e4b548c91f3/main.py#L98

    • @purnaschicago
      @purnaschicago 10 หลายเดือนก่อน

      @@AkamaiDeveloper It will be very helpful if you can add the link to the repo in the video description.

  • @parij4840
    @parij4840 ปีที่แล้ว

    How to test the same on Postman instead of Swagger?

    • @saif201048
      @saif201048 ปีที่แล้ว

      You need to make a request from postman to your API endpoint and pass the token in auth section or in the headers.

  • @mtalhakhalid1679
    @mtalhakhalid1679 5 หลายเดือนก่อน

    just to increase length of video you make it complex.

  • @yujia562
    @yujia562 ปีที่แล้ว +8

    why dont you just tell me this is an example on their documen.. waste damn time

    • @vengtCent
      @vengtCent 8 หลายเดือนก่อน

      Link?

  • @CrashingPotatoEngineer
    @CrashingPotatoEngineer 9 หลายเดือนก่อน +2

    I'm sure this is helpful for a lot of new developers, but bare metal?

    • @nobytes2
      @nobytes2 8 หลายเดือนก่อน

      This isn't bare metal since there's an OS on top of the hardware. I assume you want docker, but if you know docker then use it, take the knowledge from this video and use containers, should be easy since you imply you're not a new dev.

    • @CrashingPotatoEngineer
      @CrashingPotatoEngineer 8 หลายเดือนก่อน +1

      @@nobytes2 Hehe I forgot about this video. Sorry I don't remember docker being brought up. Yeah this is just TH-cam auto play in action. So what I meant is that users are going to screw up their OS if they don't use a virtual environment when they install packages.

    • @nobytes2
      @nobytes2 8 หลายเดือนก่อน

      @@CrashingPotatoEngineer ah ok gotcha makes sense, yeah lots of tuts don't use virtual environments. Nowadays I use poetry instead of venv.

  • @supax5073
    @supax5073 หลายเดือนก่อน +1

    You stolen this from the fastapi official website. This simple means he does never have the experience for, even my 5 years old brother can read a documentations and do as it says. Matter fact, he is not the only one. Most of TH-camrs like him, always stole documentations, and shamelessly coping and posting from the official web. Rather at least, at least, at minimum least have some respect for your viewers and change the official code to alternative code using same approach. Not only that but you also copied it letter pre letter and line be line.
    Not all whom who have nice desktop setups, is a backend or frontend dev. Rather simple, some guy trying make a living out of youtube. I get it man do your thing, but at least have some respect for your viewers.

  • @basembarakat
    @basembarakat 8 หลายเดือนก่อน

    Thanks for the tutorial. Wondering when the token expiration time is checked? Does jwt.decode check this internally?

  • @drchastr208
    @drchastr208 ปีที่แล้ว

    great video thank you Tim .

  • @MMubeenOfficial
    @MMubeenOfficial 19 วันที่ผ่านมา

    Sir it giving me internal server error when I tried to authorize and saying me to "unauthorized". Can you please let me know what is the error and how to solve it?

  • @user-on9bn1co8w
    @user-on9bn1co8w ปีที่แล้ว

    How to install fastapi with out internet

  • @Lexaire
    @Lexaire 6 หลายเดือนก่อน +10

    You just stole the tutorial from the official FastAPI docs.

    • @cidhighwind8590
      @cidhighwind8590 5 หลายเดือนก่อน +6

      So?

    • @cunning_fox-cs8nx
      @cunning_fox-cs8nx 2 หลายเดือนก่อน +2

      he explained it in nice manner.

    • @ibknl1986
      @ibknl1986 หลายเดือนก่อน

      This is still OK. Really appreciate his efforts

    • @wycliffakumu8366
      @wycliffakumu8366 21 วันที่ผ่านมา

      You can as well stole😂

  • @jeff_gh
    @jeff_gh ปีที่แล้ว

    Would the same logic apply if I'd use Templates (jinja2) to display a frontend?

    • @jnone2488
      @jnone2488 ปีที่แล้ว

      Yes and you would have to use key words in templates to display values in front

  • @freecelpip
    @freecelpip ปีที่แล้ว +2

    aweful video!

    • @wylde780
      @wylde780 11 หลายเดือนก่อน +4

      Why would you take the time to insult someone who put effort into sharing his knowledge with the community?

    • @xuantungnguyen9719
      @xuantungnguyen9719 8 หลายเดือนก่อน +1

      I agree. All he did is just typing and typing. Very little intuition.

  • @DARKarknar
    @DARKarknar 8 หลายเดือนก่อน

    45:33

  • @Perdite_smachno
    @Perdite_smachno 9 หลายเดือนก่อน

    Гашиш в русском переводе, норм перевод

  • @pepeshopping
    @pepeshopping ปีที่แล้ว +2

    Well. For an API, I would probably NEVER EVER use a program!!!

    • @ericadams4101
      @ericadams4101 ปีที่แล้ว

      I, too, have no idea what this means.

    • @7dainis777
      @7dainis777 ปีที่แล้ว

      Your comment does not make sense. What do you mean?

    • @DominickWalenczak
      @DominickWalenczak 5 หลายเดือนก่อน

      If you're not using a program for an API, how are you handling API's? On paper?