如何使用空手道OAUTH 2.0授权授权类型获取访问令牌
我试图使用空手道框架自动化以下步骤,然后在邮递员中进行的步骤。 我在Postman中尝试的方式:
- ON授权选项卡选择OAuth 2.0
- 选择标头前缀载体
- 授予型是“隐式”,
- 我将回调URL放置
- 在我放置auth url
- 我放置client ID
- 选择“客户端身份验证”作为Send作为基本auth标头。
我使用以下代码以获取访问令牌 背景:
* url 'Auth URL'
Scenario: Verify the user details using OAuth2 Implicit grant type
* form field callbackurl = 'callbackurl'
* form field grant_type = 'implicit'
* form field client_id = 'client id'
* form field username = 'username'
* form field password = 'password'
* method post
* status 200
* print response
* def accessToken = response.access_token
* path 'resource'
* header Authorization = 'Bearer ' + accessToken
# * param access_token = accessToken
* method post
* status 200
在输出中我得到 // Springboard的前端没有UserPoolid。我们不使用UserPoolid //无论如何,除了放置上下文数据外。 var userpoolid =“”; var clientid = geturlParameter(“ client_id”);
我不知道我在哪里错了。请提供您的帮助。谢谢!
I tried to automate using karate framework following steps which I did in postman.
How I tried in Postman:
- On Authorization tab select OAuth 2.0
- Select Header Prefix Bearer
- Grant-Type is "Implicit"
- I put Callback URL
- I put Auth URL
- I put Client ID
- Select "Client Authentication" as Send as Basic Auth Header.
I used following code in order to get Access token
Background:
* url 'Auth URL'
Scenario: Verify the user details using OAuth2 Implicit grant type
* form field callbackurl = 'callbackurl'
* form field grant_type = 'implicit'
* form field client_id = 'client id'
* form field username = 'username'
* form field password = 'password'
* method post
* status 200
* print response
* def accessToken = response.access_token
* path 'resource'
* header Authorization = 'Bearer ' + accessToken
# * param access_token = accessToken
* method post
* status 200
In output I got
// UserpoolId is not available on frontend for springboard. We do not use userPoolId
// anyway other than put in context data.
var userPoolId = "";
var clientId = getUrlParameter("client_id");
I do not know where I am wrong. Please provide your help. Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论