forked from bachya/simplisafe-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth
More file actions
executable file
·34 lines (26 loc) · 861 Bytes
/
Copy pathauth
File metadata and controls
executable file
·34 lines (26 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
"""Initiate the SimpliSafe authorization process."""
import asyncio
import sys
import webbrowser
from simplipy.util.auth import (
get_auth_url,
get_auth0_code_challenge,
get_auth0_code_verifier,
)
async def main() -> None:
"""Run!"""
code_verifier = get_auth0_code_verifier()
code_challenge = get_auth0_code_challenge(code_verifier)
auth_url = get_auth_url(code_challenge)
try:
input("Press <ENTER> to be taken to the SimpliSafe login page... ")
except KeyboardInterrupt:
sys.exit(1)
webbrowser.open(auth_url)
auth_code = input("Enter the code received from the SimpliSafe auth webpage: ")
print()
print("You are now ready to use the SimpliSafe API!")
print(f"Authorization Code: {auth_code}")
print(f"Code Verifier: {code_verifier}")
asyncio.run(main())