openmhealth / omh-dsu-ri

An application for storing mobile health data and authorizing access to it.
http://www.openmhealth.org/documentation/#/store-data/storage-overview
Apache License 2.0
39 stars 32 forks source link

Adding Client error #11

Open NiharP opened 8 years ago

NiharP commented 8 years ago

Could you please provide me instructions how can i add client? I am able to add row to the oauth_client_details table. Because of which, when i call /oauth/token rest service. I am getting unauthorized access error. Can you please explain me how to add client?

Thanks

emersonf commented 8 years ago

The documentation is surprisingly lacking, I thought we had instructions on getting access tokens. We'll get that fixed.

Adding a row to oauth_client_details is correct. Once you do, you should use HTTP Basic to request the access token from the /oauth/token endpoint. If the client ID is testClient and the client secret is testClientSecret, then Base64 encode testClient:testClientSecret and set it as an Authorization header, in this case with value Basic dGVzdENsaWVudDp0ZXN0Q2xpZW50U2VjcmV0. You can see examples in the Postman requests.