Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Resource Owner Credentials flow
curl -H “Content-Type: application/json" \
-d '{"client_id":"a11bbd9c339e6d8bd84368061089971398e23617d88a7c8dd060555b7cff1077","client_secret":"f079dadcca08a26d5967421f3849447e1e4519d6ba33cabdd4bdd0c86aebded3","grant_type":"password","username":"test@example.com","password":"passw0rd"}' /
-X POST http://localhost:3000/oauth/token
{“access_token":"aa7511182a980a31f0f1bacfa396a7d7c1bb082fcd6c5e24970e9a15473f0eb9","token_type":"bearer","expires_in":7200,"refresh_token":"b80adab50c6e851525152e24a4b48721d47dcf21cf0701263564b3ccffeb3619"}
curl -H "Content-Type: application/json" \
-d '{"access_token":"aa7511182a980a31f0f1bacfa396a7d7c1bb082fcd6c5e24970e9a15473f0eb9"}' \
--include -X GET https://localhost:3000/api/v1/users
# config/initializers/doorkeeper.rb
Doorkeeper.configure do
resource_owner_from_credentials do |routes|
u = User.find_for_database_authentication(:email => params[:username])
u if u && u.valid_password?(params[:password])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.