繁体   English   中英

gem'omniauth-stripe-connect' - 身份验证失败,invalid_credentials,invalid_grant

[英]gem 'omniauth-stripe-connect'-Authentication failure, invalid_credentials, invalid_grant

在我看来:

<form action="/users/auth/stripe_connect">
    <input type="hidden" name="response_type" value="code" />
    <input type="hidden" name="client_id" value="<%= STRIPE_CLIENT_ID %>" />
    <input type="hidden" name="scope" value="read_write" />
    <input type="hidden" name="stripe_user[product_category]" value="charity" />
    <input type="text" placeholder="Enter Amount" name="state">
    <input class="btn green search_button" type="submit" value="Donate" />
</form>

在我的开发中.rb:

STRIPE_CLIENT_ID ='我的客户端ID'STRIPE_SECRET ='我的客户端密码'

在我的omniauth_callbacks_controller中:

def stripe_connect
    # Delete the code inside of this method and write your own.
    # The code below is to show you where to access the data.
    raise request.env["omniauth.auth"].to_yaml
  end

在我的routes.rb

devise_for :users, :controllers => { :omniauth_callbacks => "omniauth_callbacks" }

在我的config / initializers / omniauth.rb中:

 Rails.application.config.middleware.use OmniAuth::Builder do
     provider :stripe_connect, STRIPE_CLIENT_ID, STRIPE_SECRET
  end

在我的devise.rb

config.omniauth :stripe_connect,
    STRIPE_CLIENT_ID,
    STRIPE_SECRET,
    :scope => 'read_write', # or :scope => 'read_only'
    :stripe_landing => 'login

提交表单我正在重定向到https://connect.stripe.com/oauth/authorize然后我在我的控制台上收到错误

验证失败! invalid_credentials:OAuth2 :: Error,invalid_grant:此授权码已被使用。 使用此代码发出的所有令牌均已被撤销。 {“error”:“invalid_grant”,“error_description”:“此授权码已被使用。使用此代码发出的所有令牌均已被撤销。” }

我已经在条纹上注册了我的应用程序。 提前致谢。

如果您使用devise来指定连接详细信息,则不需要在omniauth.rb或development.rb中指定它们。 您只需要包含一次客户端ID和密码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM