Python package for the threebot authenticator app
Project description
Python package for interacting with threefold login
Usage
Initialize the authenticator
from ThreefoldLoginPkg import ThreefoldLogin
import string
import random
api_host = 'https://login.staging.jimber.org'
app_id = 'testapp'
seed_phrase = seed_phrase = 'calm science teach foil burst until ' \
'next mango hole sponsor fold bottom ' \
'cousin push focus track truly tornado ' \
'turtle over tornado teach large fiscal'
redirect_url = "/callback"
kyc_backend_url = 'https://openkyc.staging.jimber.org'
authenticator = ThreefoldLogin (api_host,
app_id,
seed_phrase,
redirect_url,
kyc_backend_url
)
Generate a login request
allowed = string.ascii_letters + string.digits
state = ''.join(random.SystemRandom().choice(allowed) for _ in range(32))
url = authenticator.generate_login_url(state)
Redirect the user to the giving URL
Redirect the user to url
Callback
The callback will be send to https://{app_id}/{redirect_url}
try:
authenticator.parse_and_validate_redirect_url(callback_url, state)
print('successfully validated login attempt')
if authenticator.is_email_verified():
print('email is verified')
else:
print('email is not verified')
except ValueError:
print('failed to validate login attempt')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
threefoldlogin-0.0.1.tar.gz
(3.2 kB
view hashes)
Built Distribution
Close
Hashes for threefoldlogin-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c5692f272c7aa9bfef7a7833cfa5a265388ec44d111da2a5b119b190c40d7ea |
|
MD5 | cdd6196fe5ff860100fea9f266a087a7 |
|
BLAKE2b-256 | e0d1c790f86b5930b62055bd7727519ebd0386515bd85ae9fc42957f15798164 |