Created
December 12, 2014 04:55
-
-
Save terenceponce/ab9b9ca1129701649315 to your computer and use it in GitHub Desktop.
Resource Owner Credentials flow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -H “Content-Type: application/json" \ | |
-d '{"client_id":"a11bbd9c339e6d8bd84368061089971398e23617d88a7c8dd060555b7cff1077","client_secret":"f079dadcca08a26d5967421f3849447e1e4519d6ba33cabdd4bdd0c86aebded3","grant_type":"password","username":"[email protected]","password":"passw0rd"}' / | |
-X POST http://localhost:3000/oauth/token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{“access_token":"aa7511182a980a31f0f1bacfa396a7d7c1bb082fcd6c5e24970e9a15473f0eb9","token_type":"bearer","expires_in":7200,"refresh_token":"b80adab50c6e851525152e24a4b48721d47dcf21cf0701263564b3ccffeb3619"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -H "Content-Type: application/json" \ | |
-d '{"access_token":"aa7511182a980a31f0f1bacfa396a7d7c1bb082fcd6c5e24970e9a15473f0eb9"}' \ | |
--include -X GET https://localhost:3000/api/v1/users |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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