Box.api oauth2访问令牌请求错误“无效的grant_type参数或参数丢失”;使用POSTMAN时 [英] Box.api oauth2 acces token request error "Invalid grant_type parameter or parameter missing" when using POSTMAN

查看:1834
本文介绍了Box.api oauth2访问令牌请求错误“无效的grant_type参数或参数丢失”;使用POSTMAN时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文档( http://developers.box.com/oauth/ )建议使用邮递员或卷曲。

The documentation (http://developers.box.com/oauth/) suggests using POSTMAN or curl.

在此示例中,clientID为123,密码为456,依此类推。

in this example, the clientID is 123, secret code is 456 and so on.

我正在使用邮差。
在上一步中,我通过以下方式获得了访问代码:
https://www.box.com/api/oauth2/authorize?response_type=code&client_id=123
假设响应是xyz

I am using Postman. In a prior step, I have obtained an access code via: https://www.box.com/api/oauth2/authorize?response_type=code&client_id=123 let's say the response is xyz

在下一步中,我使用POSTMAN发出POST命令(加密码)
https://www.box.com/api/oauth2/token?grant_type=authorization_code&client_id=123&client_secret=456& ; code = xyz

In the next step, I use POSTMAN to issue a POST command (urlencoded) https://www.box.com/api/oauth2/token?grant_type=authorization_code&client_id=123&client_secret=456&code=xyz

我在获得步骤1中的代码的30秒内完成了所有这些操作。

I do all of this within 30 seconds of obtaining the code in step 1.

错误为{ error: invalid_request, error_description:无效的grant_type参数或缺少参数}

The error is {"error":"invalid_request","error_description":"Invalid grant_type parameter or parameter missing"}

我尝试过的替代方法:添加redirect_uri,添加response_type,仅对正文进行编码h%D〜%括号。

Alternatives I've tried: adding a redirect_uri, adding a response_type, only encoding the body with %D~% brackets.

我注意到关于Box on stackoverflow的至少5个类似问题,没有一个得到公认的解决方案,尽管没有给POSTMAN(文档建议)。

I notice at least 5 similar questions for Box on stackoverflow, none with acknowledged solutions, though none with POSTMAN (which the documentation suggests).

通过POSTMAN获取BOX API的访问令牌的解决方案是什么?

What is the resolution for obtaining an access token via POSTMAN for the BOX API?

推荐答案

我相信 / token 请求的问题是您将参数放入查询字符串中。这些应该改为包含在POST请求正文中。

I believe the problem with the /token request is that you're putting the parameters in the query string. These should instead be included in the POST request body.

这篇关于Box.api oauth2访问令牌请求错误“无效的grant_type参数或参数丢失”;使用POSTMAN时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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