Two-Factor Authentication (2FA) in Python

Поділитися
Вставка
  • Опубліковано 31 лип 2024
  • Today we learn how to generate and verify one-time passwords (OTP) for two-factor authentication (2FA) in Python.
    ◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
    📚 Programming Books & Merch 📚
    🐍 The Python Bible Book: www.neuralnine.com/books/
    💻 The Algorithm Bible Book: www.neuralnine.com/books/
    👕 Programming Merch: www.neuralnine.com/shop
    🌐 Social Media & Contact 🌐
    📱 Website: www.neuralnine.com/
    📷 Instagram: / neuralnine
    🐦 Twitter: / neuralnine
    🤵 LinkedIn: / neuralnine
    📁 GitHub: github.com/NeuralNine
    🎙 Discord: / discord
    🎵 Outro Music From: www.bensound.com/
    Timestamps:
    (0:00) Intro
    (0:18) Time-Based OTP
    (6:25) Counter-Based OTP
    (8:28) Google Authenticator QRCode
    (11:46) Outro
  • Наука та технологія

КОМЕНТАРІ • 43

  • @Lorry127
    @Lorry127 8 днів тому +1

    Great video! Brief, informative, precise, and without BS. Keep up the fantastic work!

  • @captainobvious7898
    @captainobvious7898 3 місяці тому +2

    Excellent to the point video without wasting any time with nonsense. Learned exactly what I came here for, nothing more, nothing less. This is a perfect example of what all UA-cam tutorial videos should be.

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

    Best channel for python developers ever, I learn a lot from you man!!

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

    Awesome, man. As always very interesting content showing practical use of nice things.

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

    Thank you 😊 This video came at just the right time for me. It will allow me to very easily add 2FA to an app that I'm currently developing.

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

    This is awesome. This is similar to the project I am building in my current class. I added similar code to flask app along with html files to create webpages😊🎉

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

    Thank you! So helpful and practical.

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

    Awesome! Thank you for the great content.

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

    Very useful demo. Thanks :)

  • @user-tw9oo1kd9g
    @user-tw9oo1kd9g 11 місяців тому

    Thank you for great tutorial!

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

    Very useful. Thank you for the tutorial

  • @user-po5nc8pw1b
    @user-po5nc8pw1b 11 місяців тому

    Thank you for the video.

  • @elricho72
    @elricho72 9 місяців тому

    Great chanel !, awesome example, thank you

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

    Great stuff

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

    Beautiful man! Can you make a video and explain how to have a different code for each computer?

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

    Great Great🔥🔥

  • @kiiikoooPT
    @kiiikoooPT 9 місяців тому +2

    this is very usefull, but I'm looking for kind of the oposite, like I want to make the authenticator itself, what I mean is, I want to make my own app where I can scan the qr code or something, and aply the uri there from any service, to keep them all in the same app, my own app.
    and you probably will ask why, well i have a bunch of acounts and 3 Auth apps, and some accounts dont work with some Auth apps, you need a specific auth app for that type of account, so I wonder if is possible to make your own Auth app and have all the accounts on it???

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

    hey brother can u plz. tell u r from which university and what are u learning like ur major and all.......

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

    I want ask you question please
    Can I send sms messages for my phone use python
    Or use USB
    Or use kivy
    I mean same apk sms messages in phone📱

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

    I get the following error:
    TypeError: argument should be a bytes-like object or ASCII string, not 'list'
    What do i do?😭

  • @Salmanmushtaq-cs3jm
    @Salmanmushtaq-cs3jm 2 місяці тому

    I create the uri and generate the QRCODE, when I scan using google authenticator it shows "key not recognized"

  • @c0rp0rat1on1
    @c0rp0rat1on1 9 місяців тому

    I am trying to do this in bit different way but I get non base32 detection error and I am not able to log in to my broker plz help

  • @santaclausiscomingtotown3923

    love!

  • @Salmanmushtaq-cs3jm
    @Salmanmushtaq-cs3jm 2 місяці тому

    when i generate qrcode and scan using google authenticator i received error "key not recognized"

  • @1DannyJh
    @1DannyJh Рік тому

    gracias!

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

    Great...

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

    Great Video!
    Is it advisable to have some sort of destruction mechanism on that QR Code?
    Otherwise, anyone that scans it would be able to add it to an authenticator app?
    Or does that QR Code already come with some sort of OTP encrypted?

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

    I want to inform other people, that the key needs to be more than 19 letters. You will get an error, if you the key has less than 20 letters.

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

    Please make a video on python with keycloak it has all these features and 2fa and main thing is its open source

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

    Hey what do i do when i try to scan the qr with google authenticator and it says that error: key not recognised?
    any solutions/ideas?

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

      pyotp.totp.TOTP(base64.b32encode(secret_key))
      google authenticator needs converted base32 key

  • @-sothea2143
    @-sothea2143 Рік тому

    👌💖

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

    How to increase time from 30 seconds to 3 minutes or more??

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

      You can't increase the duration that a TOTP token is valid.
      However you can add an extra argument in the verify function to increase the window of tokens that will be valid:
      # accept the current, previous and next token (for most applications this should be sufficient):
      pyotp.verify(otp=, valid_window=1)
      # accept the current, previous 3 and next 3 tokens:
      pyotp.verify(otp=, valid_window=3)

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

    Hi ModuleNotFoundError: No module named 'pyotp'

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

    Comment for engagement

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

    the key has to be base64, not string

  • @shad-intech
    @shad-intech Рік тому

    Happy I will not be writing the logic provided py PyOTP from scratch.

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

    too much import you show nothing...

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

    Nice ! Thanks! Great video!
    Little question.. I'm trying to in my provisioning_uri to send an image.. (to be able to have it in the autentication app ..like microsoft, etc).. but so far without success ... i have not found any documentation related.. any ideas ?
    uri = totp.provisioning_uri(name=user, issuer_name=company, image=url)
    url = "XXXXX/myimage.png"
    i dont receive any error.. but also no image in the app