[英]Bigcommerce redirect_uri_mismatch oauth2 error
我無法在登台/制作服務器中使用bigcommerce oauth授權我的rails應用程序。 使用ngrok在開發中使用相同的配置/代碼。
收到錯誤消息:( bigcommerce)身份驗證失敗! invalid_credentials:OAuth2 :: Error,redirect_uri_mismatch:參數redirect_uri與注冊的URI不匹配{“error”:“redirect_uri_mismatch”,“error_description”:“參數redirect_uri與注冊的URI不匹配”}
這是應用程序發送到bigcommerce登錄服務器的內容:
然后Bigcommerce調用app回調:
我很確定redirect_uri傳遞給登錄服務器與我在我的應用程序回調網址(復制粘貼)中輸入的相同。
寶石使用:寶石'設計','〜> 2.2.4'寶石'omniauth-bigcommerce'gem'bigcommerce',:github =>'mechatama / bigcommerce-api-ruby',: branch =>'oauth'
我錯過了什么嗎? 過去幾天我一直在尋找解決方案。
您需要在devise.rb上添加基於環境的重定向uri
example :
setup: (lambda do |env|
request = Rack::Request.new(env)
env['omniauth.strategy'].options['token_params'] = {:redirect_uri => 'http://localhost:81/users/auth/google_oauth2/callback'}
# http://e3a098b5.ngrok.io/users/auth/google_oauth2/callback
end
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.