【问题标题】:Angular-5 StripeConnect -303 Error -Response for Preflight is invalid (Redirect)Angular-5 StripeConnect -303 错误 - 预检响应无效(重定向)
【发布时间】:2018-12-06 23:06:15
【问题描述】:

我正在使用 Angular 5 和 Asp.NetCore 进行 StripeConnect(标准帐户类型)。 我可以使用 code={} 值重定向到所需的 URL。 当我尝试在以下 URL 中使用此 代码 时,

https://connect.stripe.com/oauth/token\client_secret={{秘密测试密钥}}\code={{code}}\grant_type = authorization_code"

1.我的角度解决方案在浏览器中出现 preflight is invalid (Redirect) 错误。

2.来自 Postman 的条带登录页面的 html。

我为对上述 URL(角度)进行 post 调用而编写的代码是:

getCredentialsFromStripe(code: any) 
    {
      let Url = "https://connect.stripe.com/oauth/token"; 
                //\client_secret=" + {{key}} + "\code=" + code + "\grant_type 
        = authorization_code";

      return this.http.post(Url, {
        Body: "client_secret = {{key}}\code =" + code,
        Headers: {
              'Authorization': 'Bearer '+ code,
              "Accept": "application/json; charset=UTF-8",
              "Access-Control-Allow-Origin": "https://connect.stripe.com/oauth/token"
      }
   }).map(res => res.json());
}

根据互联网上的建议,我尝试从后端进行 post 调用(.NET core(2.0) API 为我),但没有通过为标准帐户类型创建帐户。

此外,邮递员的测试是提供登录的完整 html 页面,而不是获取此对象:

{
  "token_type": "bearer",
  "stripe_publishable_key": "{PUBLISHABLE_KEY}",
  "scope": "read_write",
  "livemode": false,
  "stripe_user_id": "{ACCOUNT_ID}",
  "refresh_token": "{REFRESH_TOKEN}",
  "access_token": "{ACCESS_TOKEN}"
}

任何人都可以在这方面给我一个线索。我已经被困过去两天了。

任何想法都将不胜感激。

【问题讨论】:

    标签: angular5 stripe-connect http-status-code-303


    【解决方案1】:

    好吧,我能够修复它。我没有在 Angular 项目中(在 node.js 文档之后)使用 URL(上面给出)创建帐户,而是在 Asp.net 核心(我的 api 解决方案)中调用了 stripe api 并调用了它们。它很容易工作。

    【讨论】:

      猜你喜欢
      • 2016-10-20
      • 2016-06-20
      • 2018-02-21
      • 2018-02-13
      • 2018-12-25
      • 2017-04-25
      • 2017-11-15
      • 1970-01-01
      • 2019-03-21
      相关资源
      最近更新 更多