Reputation: 99
I use the Doorkeeper gem to introduce OAuth 2 provider functionality to my Rails application. I added the gem to gemfile, configure it and trying to make post request to get access token as described in the documentation.
I sent post request to this url - http://localhost:3000/oauth/token with this parameters:
client_id=c094523a20444ee3362e8eb33e08b5266cfb6486babe9f918c0c88104e67f6c0&client_secret=d6cebe57e475e685beb2401108438991e94f0078152d52a2da4d5f1307a4729c&code=c2f56975ba6970634deef1e256faa5de5b146f794f37b3c59f3b5111d6810ef6&grant_type=authorization_code&redirect_uri=urn:ietf:wg:oauth:2.0:oob
But I get the error:
{"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."}
My doorkeeper initializer:
Doorkeeper.configure do
# Change the ORM that doorkeeper will use (needs plugins)
orm :active_record
# This block will be called to check whether the resource owner is authenticated or not.
resource_owner_authenticator do
current_user || warden.authenticate!(scope: :user)
end
end
Upvotes: 4
Views: 1340
Reputation: 51
I had exactly the same problem with doorkeeper 4.3+ The solution is to use doorkeeper 4.2.6
Upvotes: -1