【问题标题】:Stripe Connect code processed by AWS Amplify Auth由 AWS Amplify Auth 处理的 Stripe Connect 代码
【发布时间】:2019-09-13 01:36:30
【问题描述】:

在我的 Angular 项目中,我使用 OAuth and Hosted UI 配置了 AWS Amplify。

一切正常。当我想与 Google 建立联系时,我会被重定向回一个类似 http://localhost:4200/?code=de79bfa4-xxxxxx&state=2xxxxxx 的网址,该网址由 AWS Amplify Hub 很好地处理。

现在,我想在我的项目中配置 Stripe Connect,它也使用OAuth connection flow

所以我通过添加如下链接来配置文档中定义的 OAuth 链接:

<a class="stripe-connect" href="https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_xxxxxx&scope=read_write"><span>Connect with Stripe</span></a>

问题

我被重定向回一个类似http://localhost:4200/stripe?scope=read_write&code=ac_xxxxxx的网址

不幸的是,这个 url 也被 Amplify 处理了,我收到以下错误消息:

zone.js:1152 发布https://[domain].amazoncognito.com/oauth2/token 400

core.js:15724 ERROR 错误:未捕获(在承诺中):错误:invalid_grant

错误:invalid_grant

这是可以理解的,因为 Amplify 尝试处理 Stripe Connect 代码..

但我不知道如何纠正这种行为。

有解决这个问题的办法吗?

复制

  1. 使用 Amplify Auth Hosted UI 配置示例存储库
  2. 编辑 stripe.component.html 中的 Stripe client_id
  3. 启动项目
  4. 与谷歌联系
  5. 导航到设置
  6. 点击链接“Connect with Stripe”
  7. 在 Stripe 表单上,点击“忽略此帐户表单”
  8. 查看错误

【问题讨论】:

    标签: angular stripe-payments aws-amplify


    【解决方案1】:

    我联系了 Amplify 团队,这是正常行为:

    https://github.com/aws-amplify/amplify-js/issues/3157

    使用 Amplify 中的 OAuth 流程和代码授权流程,一旦您获得 从第 3 方重定向回来的 Amplify 将自动解析 用于检索代码并使用它来检索凭据的 URL 第 3 方 /token 端点。

    很遗憾,目前我们无法为 Amplify 添加异常甚至过滤器以不自动解析 URL。

    【讨论】:

      猜你喜欢
      • 2014-01-11
      • 2020-11-18
      • 2019-12-25
      • 2023-02-03
      • 2021-11-16
      • 1970-01-01
      • 2017-09-02
      • 2019-09-02
      • 2023-02-08
      相关资源
      最近更新 更多