APISamples_Authentication - POPRecarga/PartnerAPI GitHub Wiki

#Authentications

Method Resource Notes
POST /token Retrieves an access token to use the system

Valid POST at /token request:

POST /token HTTP/1.1
Host: api.sandbox.inpdv.com.br
content-type: application/x-www-form-urlencoded;charset=utf-8
Content-Length: 92

grant_type=client_credentials&client_id=3&client_secret=3333

Success POST at /token response:

HTTP/1.1 200 OK

{
    "access_token":"twMJV2sS8Y6SrliNlG6tVOnEQAsDuHEAUUm4j527udtpkV2WYGYeJ97…",
    "token_type":"bearer",
    "expires_in":3599,
    "scopes":"OneClickPayment",
    ".issued":"Thu, 11 Feb 2016 19:50:57 GMT",
    ".expires":"Thu, 11 Feb 2016 20:50:57 GMT"
}

Wrong client_id/client_secret at /token POST response:

HTTP/1.1 400 Bad Request

{
    "error":"invalid_client"
}

If the access token is expired/not valid, the sample response of any request will be:

HTTP/1.1 401 Unauthorized
Content-Length: 61
Content-Type: application/json; charset=utf-8

{
    "message":"Authorization has been denied for this request."
}
⚠️ **GitHub.com Fallback** ⚠️