使用box-python-sdk与Box Developer Edition进行身份验证 [英] Authenticate with Box Developer Edition using box-python-sdk

查看:132
本文介绍了使用box-python-sdk与Box Developer Edition进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用 box-python-sdk 认证到Box Developer Edition,方式:

I want to authenticate to Box Developer Edition using box-python-sdk, this way:

auth = JWTAuth(
    client_id='YOUR_CLIENT_ID',
    client_secret='YOUR_CLIENT_SECRET',
    enterprise_id='YOUR_ENTERPRISE_ID',
    rsa_private_key_file_sys_path='CERT.PEM',
    store_tokens=your_store_tokens_callback_method,
)

(1)我已经使用应用程序身份验证说明,并解密了私钥。如何获得CERT.PEM?

(1) I have created a private and public key using the App Auth instructions, and decrypted the private key. How do I get the CERT.PEM?

(2)your_store_tokens_callback_method应该做什么?

(2) What is the your_store_tokens_callback_method supposed to do?

推荐答案

cert.pem 应该是作为私钥的文件的路径。

cert.pem should be a path to a file that is your private key.

your_store_tokens_callback_method 应该是运行并保留从Box取回的令牌的lambda,以便您可以进行其他经过身份验证的呼叫。

your_store_tokens_callback_method should be a lambda that runs and persists the tokens you get back from Box so you can make additional authenticated calls.

签出 https://github.com/box/box-box-python-sdk/blob/1b2d19662e904a2cc850dab2c66ee122c3b3e20e/README.rst#get-the-authorization-url 例如 store_tokens

def store_tokens(access_token, refresh_token):
    # store the tokens at secure storage (e.g. Keychain)

这篇关于使用box-python-sdk与Box Developer Edition进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆