【问题标题】:Stripe OAuth - redirect URL = "No route matches [GET] "/oauth/callback"Stripe OAuth - 重定向 URL = "没有路由匹配 [GET] "/oauth/callback"
【发布时间】:2016-07-10 20:16:00
【问题描述】:

在 Heroku 上托管时,我的 Stripe Connect 重定向 URL 出现问题。

在本地运行,一切正常,用户使用 OAuth 连接,将可发布的密钥保存到数据库,然后通过站点正常进行。

然而,在 Heroku 上,用户通过 OAuth 连接到 Stripe,输入他们的详细信息和密码,然后在重定向时,他们会收到以下错误消息:

Heroku | No such app
There is no app configured at that hostname.
Perhaps the app owner has renamed it, or you mistyped the URL.

到目前为止,文档没有帮助,我在 Stack Overflow 上也找不到类似的东西。

条纹细节:

生产重定向 URI:https://www.hidden-hamlet-51741.herokuapp.com/oauth/callback

我尝试了一些变化,但没有成功。

Heroku 日志:

2016-03-23T13:23:37.799909+00:00 heroku[router]: at=info method=GET path="/users/auth/stripe_connect" host=hidden-hamlet-51741.herokuapp.com request_id=4d52e646-6d02-45be-87e6-7492665c4d17 fwd="86.138.166.211" dyno=web.1 connect=2ms service=19ms status=302 bytes=1549
    2016-03-23T13:23:37.796546+00:00 app[web.1]: Started GET "/users/auth/stripe_connect" for 86.138.166.211 at 2016-03-23 13:23:37 +0000
    2016-03-23T13:23:37.799240+00:00 app[web.1]: I, [2016-03-23T13:23:37.799170 #3]  INFO -- omniauth: (stripe_connect) Request phase initiated.
    2016-03-23T13:30:57.289321+00:00 app[web.1]: Started GET "/users/auth/stripe_connect" for 86.138.166.211 at 2016-03-23 13:30:57 +0000
    2016-03-23T13:30:57.306551+00:00 app[web.1]: I, [2016-03-23T13:30:57.306458 #3]  INFO -- omniauth: (stripe_connect) Request phase initiated.
    2016-03-23T13:30:57.309718+00:00 heroku[router]: at=info method=GET path="/users/auth/stripe_connect" host=hidden-hamlet-51741.herokuapp.com request_id=e7805fd0-3973-4a27-b842-433e1dbb1532 fwd="86.138.166.211" dyno=web.1 connect=2ms service=30ms status=302 bytes=1549

将我的 Production.rb 文件更改为“config.consider_all_requests_local = true”并再次推送到 Heroku 后,收到以下错误消息:

No route matches [GET] "/oauth/callback"

我的 Stripe OAuth 相关路由如下所示:

user_omniauth_authorize GET|POST /users/auth/:provider(.:format)        omniauth_callbacks#passthru {:provider=>/stripe_connect/}
user_omniauth_callback GET|POST /users/auth/:action/callback(.:format) omniauth_callbacks#(?-mix:stripe_connect)
stripe_connect GET      /stripeconnect(.:format)               groups#stripe

任何指针都会非常有帮助。

谢谢。

【问题讨论】:

    标签: ruby-on-rails heroku oauth stripe-connect


    【解决方案1】:

    答案:

    我的 Stripe Dashboard 上的重定向 URL 不正确,是 /oauth 而不是 /auth,这是一个简单的脑误操作。

    然后在更改此设置后,我不得不运行“figaro heroku:set -e production”,这是我在 SO 上的某处找到的,它将所有变量的值设置为生产,文档中的更多详细信息 - https://github.com/laserlemon/figaro

    谢谢大家,

    【讨论】:

      【解决方案2】:

      您是否将www 配置为hidden-hamlet-51741 的子域?如果没有,那么您需要从生产重定向 URI 中删除 www。它应该是这样的:

      https://hidden-hamlet-51741.herokuapp.com/oauth/callback

      【讨论】:

      • 嗨@miligraf,当我尝试删除 www 时,我从 Heroku 收到以下错误消息:“您要查找的页面不存在。您可能输入了错误的地址或页面可能已移动。”有什么想法吗?
      • @DarraghMonaghan 您的生产环境有问题,因为您说它在开发中有效。你能得到 Heroku 的回溯吗?您可以将 NewRelic 添加到您的应用程序或将此行添加到您的 production.rb 文件 config.consider_all_requests_local = true 并重新部署。
      • 所以我进行了更改,推送到 heroku,并再次尝试 OAuth 过程。收到的错误消息:没有路由匹配 [GET] "/oauth/callback" OAuth 过程对我来说还是比较新的。有什么想法吗?
      • 我的条带相关路由如下所示: user_omniauth_authorize GET|POST /users/auth/:provider(.:format) omniauth_callbacks#passthru {:provider=>/stripe_connect/} user_omniauth_callback GET|POST /users /auth/:action/callback(.:format) omniauth_callbacks#(?-mix:stripe_connect) stripe_connect GET /stripeconnect(.:format) groups#stripe
      • 忘记链接你了,@miligraf
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-08-28
      • 1970-01-01
      • 2017-12-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多