尝试获取Box API令牌时凭据无效 [英] Invalid credentials when trying to obtain box api tokens

查看:112
本文介绍了尝试获取Box API令牌时凭据无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的问题:

我按照在您网上发布的说明进行操作:使用2个快速步骤获取Box Access令牌,使用 client_id client_secret 由框提供

I followed the instructions posted at you tube: "Get Box Access Tokens in 2 Quick Steps", using the client_id and client_secretprovided by box

第一步:获取 auth_code

我将以下请求复制并粘贴到firefox中:

I copy and paste the following request in firefox:

https://www.box.com/api / oauth2 / authorize?response_type = code& client_id = MY_CLIENT_ID& state =已认证

step2:使用步骤1中的代码获取访问和刷新令牌,使用curl:

step2: use the code from step1 to get the access and refresh tokens, using curl:

curl -v -k https://www.box.com/api/oauth2/token -d 'grant_type=authorization_code&code={auth_code}&client_id={MY_CLIENT_ID}&client_secret={MY_CLIENT_SECRET}' -X POST

我得到的答复是无效的客户端凭据。我错过了什么?
预先感谢您的帮助。我真的不知道该如何解决该错误。

The reponse I get is "invalid client credentials". Did I miss something? Thanks in advance for helping. I really don't know how to troubleshoot this error.

推荐答案

如果其他新人跌倒,我会回答我自己的问题在与我相同的陷阱中:


只需删除大括号({}),这样请求将为:

I'll answer my own question in case some other newcomer falls in the same trap as I did:

Simply remove the curly brackets ({ }), so that the request will be:


curl -v https://www.box.com/api/oauth2/token -d 'grant_type=authorization_code&code=AUTH_CODE&client_id=CLIENT_ID&client_secret=CLIENT_SECRET' -X POST

并替换 AUTH_CODE CLIENT_ID CLIENT_SECRET 的相应值不添加,至少在您使用curl的情况下,不添加任何装饰字符。

and replace AUTH_CODE, CLIENT_ID and CLIENT_SECRET by their corresponding values without adding any "decorative" character, at least if you're using curl.

注意,在将路径作为 SSL_CERT_FILE 添加到 cacert.pem 文件的路径后,我也删除了-k选项环境变量,以便curl可以找到它并停止抱怨。

Notice that I also removed the -k option after adding the path to a cacert.pem file as a SSL_CERT_FILE environment variable, so that curl would find it and stop complaining.

这篇关于尝试获取Box API令牌时凭据无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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