【问题标题】:oAuth returning 400 bad requestoAuth 返回 400 错误请求
【发布时间】:2019-07-11 19:22:30
【问题描述】:

我正在使用下面 cypress 文档中的示例向我的身份验证服务器发出请求。

https://github.com/cypress-io/cypress-example-recipes/blob/aa434ffc29946d545daf4c94019f9692eb0db3e0/examples/logging-in__single-sign-on/cypress/integration/logging-in-single-sign-on-spec.js#L47

以下是我的配置,但我收到 400 错误请求。该 url 应该将我带到登录表单并授权用户,然后重定向到回调页面以获取令牌。

我错过了什么吗?

const options = {
    method: 'POST',
    url: 'https://fakeauthserver.net/Account/Login',
    qs: {
        redirect_uri: 'http://localhost:9000/login/callback',
        client_id: 'webapp',
        response_type: 'code',
        scope: 'full-access'
    },
    form: true,
    body: {
        Username: 'fakeusername@grr.la',
        Password: '123456',
        button: 'login'
    }
};

_.extend(config);

cy.request(config)

【问题讨论】:

    标签: api post oauth request cypress


    【解决方案1】:

    通常,400 Bad Request 错误发生在您在请求中发送的参数中发生错误时。检查您是否发送了所有参数,以及它们是否与您的身份提供者中注册的参数相同。

    另外,这可能是由于您在此处提出的POST 请求。根据OAuth specification,授权请求应该是GET请求。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-28
      • 2015-04-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多