Getting an access token from an API using Curl/insomnia

Associate
Joined
10 Jan 2006
Posts
483
I need to get an access token for the uber API as I am using it as a login method. However the documentation says use curl - (I am using insomnia because i prefer it)

Here are the fields it requires with curl

curl -F 'client_secret=YOUR_CLIENT_SECRET' \
-F 'client_id=YOUR_CLIENT_ID' \
-F 'grant_type=authorization_code' \
-F 'redirect_uri=YOUR_REDIRECT_URI' \
-F 'code=AUTHORIZATION_CODE' \
https://login.uber.com/oauth/v2/token

Now to get a response from Uber - Do I need to make a post request to :
https://login.uber.com/oauth/v2/token

and then put all the other details in the headers?
 
Associate
Joined
16 Apr 2007
Posts
2,208
Hi,
When I do this sort of work I use a chrome extension called postman. This lets you do posts/puts/gets etc with whatever you want to send and lets you see results. It works great and is quick to figure out what you should and shouldnt be sending.
Not sure if you have read the docs but it seems first you need to send a get to authorize with your details are arguments. You will then get a redirect back which has your auth code in. (Maybe you have already done this).
While it doesnt say in the documentation that its a post the other OAuth2 systems ive used have been posts.
 
Associate
OP
Joined
10 Jan 2006
Posts
483
Im using Insomnia which is basically the same as postman but I can't seem to get a token back from API which is very frustrating.

I have the code back from the API but then I need to exchange that code for a token using those fields and I have double checked all of them to make sure they are right and made sure I got a new code once the other one had expired.
 
Back
Top Bottom