gpt4 book ai didi

javascript - Rails 设计 + omniauth-stripe-connect "Authorization code does not belong to you"

转载 作者:数据小太阳 更新时间:2023-10-29 08:02:33 24 4
gpt4 key购买 nike

我将 Rails 与 Devise 和 omniauth-stripe-connect gem 结合使用。

设计.rb

config.omniauth :stripe_connect,
ENV['STRIPE_CONNECT_CLIENT_ID'],
ENV['STRIPE_SECRET_KEY'],
:scope => 'read_write',
:stripe_landing => 'register'

Omniauth 回调 Controller

class OmniauthCallbacksController < Devise::OmniauthCallbacksController

def stripe_connect
@user = current_user
if @user.update_attributes({
provider: request.env["omniauth.auth"].provider,
uid: request.env["omniauth.auth"].uid,
access_code: request.env["omniauth.auth"].credentials.token,
publishable_key: request.env["omniauth.auth"].info.stripe_publishable_key
})
# anything else you need to do in response..
sign_in_and_redirect @user, :event => :authentication
set_flash_message(:notice, :success, :kind => "Stripe") if is_navigational_format?
else
session["devise.stripe_connect_data"] = request.env["omniauth.auth"]
redirect_to new_user_registration_url
end
end
end

在开发中,这工作正常,并向用户添加了 strip 连接所需的信息,但在生产中我遇到了这个错误。

{
2017-11-07T02:05:05.255495+00:00 app[web.1]: "error": "invalid_grant",
2017-11-07T02:05:05.255496+00:00 app[web.1]: "error_description": "Authorization code provided does not belong to you"

我在生产环境中设置了 live stripe api keys。我在想也许这与设计有关,但我真的不确定。

最佳答案

在我们的案例中,我们无意中使用了来自不同帐户的带有 key 的客户端 ID,这导致了类似的错误。

关于javascript - Rails 设计 + omniauth-stripe-connect "Authorization code does not belong to you",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47148926/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com