Skip to content

Instantly share code, notes, and snippets.

@jhoerr
Created August 30, 2016 12:56
Show Gist options
  • Save jhoerr/f875f3738f9a85e928b07cbb8e7b1168 to your computer and use it in GitHub Desktop.
Save jhoerr/f875f3738f9a85e928b07cbb8e7b1168 to your computer and use it in GitHub Desktop.
from boxsdk import JWTAuth
from boxsdk import Client
# automation id => 32828.... What to do with this?
auth = JWTAuth(
client_id='8grfp2...',
client_secret='1FwTmL...',
enterprise_id='322105',
jwt_key_id='qasd...',
rsa_private_key_file_sys_path='c:\\temp\\private_key_nopass.pem'
)
# create user representing me and fetch an access token for it
client = Client(auth)
me = client.user(user_id='238631333') # jhoerr@umail-test.iu.edu, in the 'iudev' instance
token = auth.authenticate_app_user(me)
# ^^^ at this point the script throws an HTTP 400 with the message,
# “Cannot obtain user token based on the enterprise configuration of your app.”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment