Hi all,
I am trying to set up a client using Ruby.
It gets a token from hydra (after user consent), this works.
Now clients wants the user to logout and therefore revoking the access token is required.
docker-compose exec hydra hydra clients create \
--endpoint http://127.0.0.1:4445 \
--id test-1 \
--secret secret \
--grant-types authorization_code,refresh_token \
--response-types code,id_token \
--scope openid,offline hydra,hydra.clients,hydra.introspect \
--callbacks http://localhost:3000/callback \
--token-endpoint-auth-method client_secret_post
I have not created any policy (not sure, what was required for revoke).
now when I call hydra.revokeOAuth2Token(token)
it gives me following error -
def revoke(access_token)
agent = Faraday.new(url: 'http://hydra:4444/')
res = agent.post('/oauth2/revoke') do |req|
req.headers['Accept'] = 'application/json'
req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
req.headers['Authorization'] = "Bearer #{access_token}"
req.body = { token: access_token }.to_json
end
JSON.parse(res.body)
end
I think the header and parameters are implemented correctly, but the following error is returned.
[4] pry(main)> Hydra::Client.revoke(t)
=> {"error"=>"invalid_request",
"error_description"=>"The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed",
"error_hint"=>"Make sure that the various parameters are correct, be aware of case sensitivity and trim your parameters. Make sure that the client you are using has exactly whitelisted the redirect_uri you specified.",
"status_code"=>400}
Did I make a mistake in what I requested?
Please help me.
Thanks for reading.