Last active
January 10, 2026 23:49
-
-
Save lovie/82962d64afd13cd4b1b5e7b5f9a5db08 to your computer and use it in GitHub Desktop.
Fetch Blink tokens for a workaround for auth with homebridge-blink-for-home-new
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| from aiohttp import ClientSession | |
| from blinkpy.blinkpy import Blink | |
| from blinkpy.auth import Auth, BlinkTwoFARequiredError | |
| USERNAME = "[email protected]" | |
| PASSWORD = "***" | |
| TOKENS_FILE = "tokens.txt" | |
| async def start(): | |
| async with ClientSession() as session: | |
| blink = Blink(session=session) | |
| # no_prompt = True as per your requirement | |
| auth = Auth( | |
| { | |
| "username": USERNAME, | |
| "password": PASSWORD, | |
| }, | |
| no_prompt=True, | |
| ) | |
| blink.auth = auth | |
| try: | |
| await blink.start() | |
| except BlinkTwoFARequiredError: | |
| # YOU handle OTP input manually | |
| otp = input("Enter Blink OTP: ").strip() | |
| await blink.prompt_2fa() | |
| # Persist tokens | |
| await blink.save(TOKENS_FILE) | |
| print(f"Tokens saved to {TOKENS_FILE}") | |
| return blink | |
| if __name__ == "__main__": | |
| asyncio.run(start()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment