OAuth2::Error 有门卫
OAuth2::Error with doorkeeper
每当我尝试向门卫提供商进行身份验证时,我总是会收到以下错误
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."}
我试过其他门卫客户端,还是一样的错误
门卫客户端:
- https://github.com/doorkeeper-gem/doorkeeper-devise-client.git
- http://dev.mikamai.com/post/112508735689/oauth2-on-rails-the-client-application
门卫提供商:
https://github.com/doorkeeper-gem/doorkeeper-provider-app.git
我通过将 omniauth-oauth2 gem 版本降级到这里提到的 1.3.1 来解决这个问题 - https://github.com/intridea/omniauth-oauth2/issues/81
虽然降级到 gem 'omniauth-oauth2', '~> 1.3.1'
已被确认是一个解决方案,但在 Doorkeeper's Create-a-OmniAuth-strategy-for-your-provider Wiki Page 中提到在您实施 OmniAuth Strategy for Doorkeeper 时应该存在以下方法:
# https://github.com/intridea/omniauth-oauth2/issues/81
def callback_url
full_host + script_name + callback_path
end
引用的内容讨论很长omniauth-oauth2 issue #81
我在尝试使用 [=36] 测试我的 Rails 5 Devise-based Doorkeeper Provider 时遇到了报告的错误=] 5 基于设计的客户端应用程序 以允许提供商的用户在我的客户端应用程序上连接他们的帐户。
由于我OmniAuth::Strategies::Doorkeeper
中没有提到的方法
在前端 Devise OmniauthCallbacksController 上闪烁消息 Invalid Credentials 并且在客户端应用程序服务器日志中看到以下错误:
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)
所以将该方法添加到策略中可以被视为替代解决方案。
谢谢。
每当我尝试向门卫提供商进行身份验证时,我总是会收到以下错误
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."}
我试过其他门卫客户端,还是一样的错误
门卫客户端:
- https://github.com/doorkeeper-gem/doorkeeper-devise-client.git
- http://dev.mikamai.com/post/112508735689/oauth2-on-rails-the-client-application
门卫提供商:
https://github.com/doorkeeper-gem/doorkeeper-provider-app.git
我通过将 omniauth-oauth2 gem 版本降级到这里提到的 1.3.1 来解决这个问题 - https://github.com/intridea/omniauth-oauth2/issues/81
虽然降级到 gem 'omniauth-oauth2', '~> 1.3.1'
已被确认是一个解决方案,但在 Doorkeeper's Create-a-OmniAuth-strategy-for-your-provider Wiki Page 中提到在您实施 OmniAuth Strategy for Doorkeeper 时应该存在以下方法:
# https://github.com/intridea/omniauth-oauth2/issues/81
def callback_url
full_host + script_name + callback_path
end
引用的内容讨论很长omniauth-oauth2 issue #81
我在尝试使用 [=36] 测试我的 Rails 5 Devise-based Doorkeeper Provider 时遇到了报告的错误=] 5 基于设计的客户端应用程序 以允许提供商的用户在我的客户端应用程序上连接他们的帐户。
由于我OmniAuth::Strategies::Doorkeeper
中没有提到的方法
在前端 Devise OmniauthCallbacksController 上闪烁消息 Invalid Credentials 并且在客户端应用程序服务器日志中看到以下错误:
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)
所以将该方法添加到策略中可以被视为替代解决方案。
谢谢。