Automate TOTP 2-Factor Authentication (2FA) with Playwright

Sdílet
Vložit
  • čas přidán 16. 06. 2024
  • A short tutorial to help you understand what goes into automating a TOTP-based 2FA flow using Playwright and the OTPAuth library.
    Goal:
    Automate a 2FA login using Playwright and OTPAuth.
    Note:
    There are multiple libraries out there for TOTP generation. Pick the one you like.
    Timestamps:
    00:00 Introduction
    00:33 TOTP for 2FA
    01:22 Approaching 2FA automation
    02:23 Extracting the TOTP secret
    03:48 Recording the script
    05:32 Generating the TOTP token
    08:19 2FA automation challenges
    10:11 Resources
    Environment:
    - MacBook Pro (13-inch, M1, 2020)
    - macOS Monterey (12.2.1)
    - Node v14.15.4
    - Playwright 1.24.2
    Resources:
    - QR decoder: zxing.org/w/decode.jspx
    - OTPAuth library: hectorm.github.io/otpauth
    - The excellent official Playwright docs: playwright.dev
    - IETF RFC6238: www.rfc-editor.org/rfc/rfc623...
    - ragog.link for more articles and notes
    Contact:
    - @rag0g on Twitter
    - linkedin.com/in/ragog
    -@Giovanni Rago on the official Playwright Slack channel
    Disclaimer
    These videos are meant to teach interested people, professionals and amateurs, how to use browser automation tools such as Playwright to write scripts for testing, synthetic monitoring, scraping and similar use cases. They center around popular websites to demonstrate real world scenarios for automation. Their aim is never to disrupt a website’s availability or violate its terms of service.
    Before you attempt automation on a publicly available website, make sure you read the terms and conditions around automation (and specifically scraping) and abide by them.
  • Věda a technologie

Komentáře • 21

  • @BoazRymland-mx9qf
    @BoazRymland-mx9qf Před rokem

    Very useful indeed, clear and concise!

  • @JustOneMoreTourist
    @JustOneMoreTourist Před 3 měsíci

    Thanks, man! Very educational! I was always wondering how others overcome it!

  • @MichaelStrother
    @MichaelStrother Před rokem

    Thank you for creating this... very helpful!

  • @pistolprasadyt8748
    @pistolprasadyt8748 Před 17 dny

    Awesomr bro.. From India

  • @jaysont5311
    @jaysont5311 Před rokem

    This is very cool. Thanks for sharing

  • @HighRollersLounge
    @HighRollersLounge Před rokem

    That was useful, thank you!

  • @flaviokonti5522
    @flaviokonti5522 Před rokem

    Thanks man, this is useful

  • @MrSpinozadp
    @MrSpinozadp Před rokem

    awesome! thx

  • @wangarewakungu9753
    @wangarewakungu9753 Před 9 měsíci

    That was helpful. Kindly do the same with Python.

  • @soumyabhat5308
    @soumyabhat5308 Před 5 měsíci +1

    How to automate when you receive OTP via text msg in phone?.

    • @Vineetkumar-hu2cs
      @Vineetkumar-hu2cs Před 4 měsíci

      I am too interested to know same asked by @soumyabhat5308

  • @davidev9107
    @davidev9107 Před 7 dny

    Java alternative ?

  • @pedritoap1
    @pedritoap1 Před 10 měsíci +2

    Amazing, I did it and did work. Do you know if it is possible to do it with python with some library?

    • @wangarewakungu9753
      @wangarewakungu9753 Před 9 měsíci +1

      I would like to know as well. Did you get a solution?

    • @diddi62
      @diddi62 Před 8 měsíci

      me too @@wangarewakungu9753

  • @amritesh94
    @amritesh94 Před rokem +1

    Does this work with Microsoft Auth Azure as well?
    In the QR i am only getting the client secret and not the period and digits

  • @marijanarukavina9499
    @marijanarukavina9499 Před 7 měsíci

    How can I make it work with Upwork, they have Authenticator app for OTP but I don’t know how to get secret since there is no QR code

  • @williamflores7323
    @williamflores7323 Před 4 měsíci

    How can I do this in python?

  • @mohitomish
    @mohitomish Před rokem +1

    Java alternative?