每当我尝试使用门卫提供商进行身份验证时,我总是会遇到以下错误
invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client. {"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
我尝试过其他门卫客户但仍然有同样的错误
门卫客户:
答案 0 :(得分:0)
我通过将omniauth-oauth2 gem版本降级到此处提到的1.3.1来解决它 - https://github.com/intridea/omniauth-oauth2/issues/81
答案 1 :(得分:0)
虽然降级为gem 'omniauth-oauth2', '~> 1.3.1'
已被确认为解决方案,但在Doorkeeper's Create-a-OmniAuth-strategy-for-your-provider Wiki Page中提到,在您实施门卫的OmniAuth策略时,应提供以下方法:
# https://github.com/intridea/omniauth-oauth2/issues/81
def callback_url
full_host + script_name + callback_path
end
中进行了长时间的讨论
当我尝试使用基于Rails 5 Devise的客户端应用来测试我的 Rails 5基于设备的门禁提供商时,我个人面临报告的错误,以允许提供商和#39;用户在我的客户端应用上连接他们的帐户。
我的OmniAuth::Strategies::Doorkeeper
中没有提到的方法
在前端Devise OmniauthCallbacksController闪烁消息无效凭据,并在客户端应用服务器日志中看到以下错误:
Started GET "/users/auth/doorkeeper" for 127.0.0.1 at 2017-08-22 17:45:02 +0530
I, [2017-08-22T17:45:02.386866 #14535] INFO -- omniauth: (doorkeeper) Request phase initiated.
Started GET "/users/auth/doorkeeper/callback?code=1b833bcc09651f98b0424a7afb1e60bd50fdcc765daf7d499bcefb5554457187&state=c215fd707ecd71c6ad0f6b5e58fa0d2da7210d86946d41e3" for 127.0.0.1 at 2017-08-22 17:45:03 +0530
I, [2017-08-22T17:45:03.506424 #14535] INFO -- omniauth: (doorkeeper) Callback phase initiated.
E, [2017-08-22T17:45:03.523737 #14535] ERROR -- omniauth: (doorkeeper) Authentication failure! invalid_credentials: OAuth2::Error, invalid_grant: The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client.
{"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
Processing by Users::OmniauthCallbacksController#failure as HTML
Parameters: {"code"=>"1b833bcc09651f98b0424a7afb1e60bd50fdcc765daf7d499bcefb5554457187", "state"=>"c215fd707ecd71c6ad0f6b5e58fa0d2da7210d86946d41e3"}
Redirected to http://localhost:5000/
Completed 302 Found in 0ms (ActiveRecord: 0.0ms)
因此,将该方法添加到策略中可视为替代解决方案。
感谢。