簡體   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