首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用OAuth2的API上的RequestsLibrary

使用OAuth2的API上的RequestsLibrary
EN

Stack Overflow用户
提问于 2017-12-21 06:47:26
回答 1查看 409关注 0票数 0

我尝试在使用OAUTH2身份验证的应用程序接口上使用RequestsLibrary,但每次它都抛出400!=200。

代码语言:javascript
运行
复制
Get authToken

    Create Session   test   http://brentertainment.com/oauth2/
    ${data}=      Create Dictionary     grant_type= 'password'      client_id=demoapp     client_secret=demopass      username= 'demouser'   password='testpass'
    ${headers}=     Create Dictionary   Content-Type= 'application/x-www-form-urlencoded'
    ${resp}=  post request     test     /lockdin/token     ${headers}     ${data}
    Should Be Equal As Strings  ${resp.status_code}     200

任何帮助都将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-12-27 01:19:35

我使用扩展请求库,而不是请求库

代码语言:javascript
运行
复制
*** Settings ***
Library    ExtendedRequestsLibrary

*** Test Cases ***
Post Request With Password

    Create Password OAuth2 Session    member    http://token     client_id    client_secret    username   password    scope   base_url
    ${var} =  get request        member    /abc
    Log    ${var.content}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47915452

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档