Getting auth token from uber is a two step process. Please refer Uber Auth API
- Ask the uber user to authorize : call GET https://login.uber.com/oauth/v2/authorize?response_type=code&client_id={client_id}&redirect_uri={redirect_uri}
Provide your client_id and redirect_uri specific to your website. If the authorization is successful, you will be redirected to your site with the code in the query parameter.
The the code you get in step 1 to retrieve auth token. Send an HTTP POST request to https://login.uber.com/oauth/v2/token. Following should be the json you send to server:
{ "client_secret": "{client_secret}", "client_id": "{client_id}", "grant_type": "{authorization_code}", "redirect_uri": "{redirect_uri}", "code": "{insert authorization code obtained in previous step}" }
In the step two I always get a error 400 with "invalid grant type" message. Please suggest where am I going wrong.