使用Box与JWT(服务器身份验证)

时间:2017-05-06 02:13:47

标签: jwt box

我使用Box API JWT服务器身份验证:

        IAccessTokenCache accessTokenCache = new InMemoryLRUAccessTokenCache(100);

        Reader reader = new FileReader("D:\\config.json");
        BoxConfig boxConfig = BoxConfig.readFrom(reader);


        BoxAPIConnection api = BoxDeveloperEditionAPIConnection.getAppUserConnection(USER_ID,boxConfig);

但是Box例外:

{"error":"unauthorized_client","error_description":"This app is not authorized by the enterprise admin"}

enter image description here

2 个答案:

答案 0 :(得分:7)

@kendomen是对的。这里有一些更详细的信息:

转到api.box.com。然后选择管理控制台。

enter image description here

现在这是它变得时髦的地方。单击“安全性”步骤。

enter image description here

然后是小字。

enter image description here

这提供了应该在三个步骤之前显示的工具栏。点击应用。

enter image description here

然后点击授权新应用程序。

enter image description here

这会弹出一个弹出窗口,您可以在其中输入应用密钥。这可以在您从Box.com下载的json文件中称为“ClientID”。

enter image description here

答案 1 :(得分:6)

Box的管理员必须转到管理控制台 - >企业设置 - >应用并授权您的应用。