How do I set up my store_tokens_callback_method?
I'm following the Traditional 3-legged OAuth2 set up. The first step is getting the authorization URL, which requires "your_store_tokens_callback_method". How do I set this up? Do I need to have the access_token and refresh_token for this? How do I get those if so?
I found an issue on github regarding this, but I'm not sure how to implement it myself.
-
You will need a method in your application. You then pass that method in place of "your_store_tokens_callback_method". When the SDK receives the tokens from Box, it will call that method and send the tokens for you to store however you need to. Something like this:
def store_tokens(access_token, refresh_token):
# store the tokens at secure storage (e.g. Keychain)
pass
auth = JWTAuth(
client_id=Config.jwt_config['client_id'],
client_secret=Config.jwt_config['client_secret'],
enterprise_id=Config.jwt_config['enterprise_id'],
jwt_key_id=Config.jwt_config['jwt_key_id'],
rsa_private_key_file_sys_path=Config.jwt_config['rsa_private_key_file_sys_path'],
rsa_private_key_passphrase=Config.jwt_config['rsa_private_key_passphrase'],
store_tokens=store_tokens,
)
Post is closed for comments.
Comments
1 comment