github.com/doorkeeper-gem/doorkeeper/wiki/Enable-Refresh-Token-Credentials github.com/doorkeeper-gem/doorkeeper/wiki/Using-Resource-Owner-Password-Credentials-flow
# Get client information from phone d = Doorkeeper::Application.last client_id = d.uid => ‘86243cce82a8ea74e78f4d9f83dd97b701bb58542f4ab1aa859fe0b4f95075ff’ client_secret = d.secret => ‘f9d09c922b38aa021e7059b7fbe5358e1c1f84233ff0bc7f5ebb5792fce9963f’
# Generate auth token based on username and password require ‘oauth2’ client = OAuth2::Client.new(‘86243cce82a8ea74e78f4d9f83dd97b701bb58542f4ab1aa859fe0b4f95075ff’, ‘f9d09c922b38aa021e7059b7fbe5358e1c1f84233ff0bc7f5ebb5792fce9963f’, site: ‘localhost:3000’) access_token = client.password.get_token(‘test@gmail.com’, ‘12345678’) puts access_token.token
http header: ‘Authorization’ => “bearer #{token}”
curl -H “Authorization: Bearer 78fdbce6ad4469a851c5d47ea69a1d390ea5b416ce5a3a2a9fc3379b438160e4” -X GET localhost:3000/payment_profiles curl -H “Authorization: Bearer 2c011180abae09025ada07a0952b7ff5af08d1167266129eafbe9bb3922ff9e2” -X GET localhost:3000/purchase_orders curl -H “Authorization: Bearer b67046dc860dd180db4b85a24b4268a7fde85fc0cffb4d01986bc6b34359d5b1” -X GET localhost:3000/users/me
# Trigger password reset curl -H “Content-Type: application/json” -H “Authorization: Bearer 54cd637cf3f7717592526b1e4f4c350cf4ceb2281230d2d191c7a2afab44ff5a” -X POST -d ‘{“user” : {“email”:“hzeng1989@gmail.com”}}’ localhost:3000/users/password
curl -H “Authorization: Bearer 78fdbce6ad4469a851c5d47ea69a1d390ea5b416ce5a3a2a9fc3379b438160e4” -X GET www.movietime.us/brands curl -H “Authorization: Bearer 78fdbce6ad4469a851c5d47ea69a1d390ea5b416ce5a3a2a9fc3379b438160e4” -X GET www.movietime.us/purchase_orders.json
curl -H “Content-Type: application/json” -H “Authorization: Bearer a80cd5b2924f6fafa1d0c2f356e9596b8a8799e6e312184d40b0b43da3b84c6f” -X PUT -d ‘{“payment_profile”: {“default”: true}}’ localhost:3000/payment_profiles/72.json
curl -H “Content-Type: application/json” -H “Authorization: Bearer a80cd5b2924f6fafa1d0c2f356e9596b8a8799e6e312184d40b0b43da3b84c6f” -X POST -d ‘{“user”: {“ios_id”: ’2341234134324’}}‘ localhost:3000/registrations/temp | python -m json.tool