from mboauth2 import AccessType, AuthClient, Scope, Token
client = AuthClient(
client_id="foo",
client_secret="bar",
redirect_uri="baz",
)
print(
"complete the auth flow at:",
client.generate_auth_url(
scopes=[Scope.PROFILE, Scope.EMAIL, Scope.COLLECTION, Scope.RATING],
access_type=AccessType.OFFLINE,
),
)
# get code from callback url
success_code_from_callback_url = "yay!"
# my_token: Token = client.retrieve_token(code=success_code_from_callback_url)
# # use the bearer token to access the api
# print("access token:", my_token.access_token)
# print("refresh token:", my_token.refresh_token)
# print("expires in:", my_token.expires_in)
# # refresh token
# my_token.refresh()