I has follow step on Path API about how to Authentication User. In the tutorial auth process, user is begin to redirect to the following URL and prompt to grant access:
https://partner.path.com/oauth2/authenticate?response_type=code&client_id=THE_CLIENT_ID
And after that, server will give response as authorization code via URL Address (i have complete this step and got the code).
As from docs explain, Code is should be exchanged for an access token using /oauth2/access_token as long with Client ID and Client Secret (get access_token)
But i don't have any clue how to POST data via cURL to the server, i has try so many curl_setopt() option and combination, but it still give me a nothing.
From the Docs, Request is look like this:
POST /oauth2/access_token HTTP/1.1
Host: partner.path.com
Content-Type: application/x-www-form-urlencoded
Content-Length: <LENGTH>
grant_type=authorization_code&client_id=CLIENT&client_secret=SECRET&code=CODE
And cURL format like this:
curl -X POST \
-F 'grant_type=authorization_code' \
-F 'client_id=CLIENT_ID' \
-F 'client_secret=CLIENT_SECRET' \
-F 'code=CODE' \
https://partner.path.com/oauth2/access_token
And server will give response like this:
HTTP/1.1 201 CREATED
Content-Type: application/json
Content-Length: <LENGTH>
{
"code": 201,
"type": "CREATED"
"reason": "Created",
"access_token": <ACCESS_TOKEN>,
"user_id": <USER_ID>,
}