Validate Customer Portal OAuth2 code

This function validates the OAuth2 code from the cPanel Customer Portal. After the function validates the token, the system stores it on the current session.

Note:

This function is not available through the command line. You must call it as a request body.

SecurityBasicAuth
Request
query Parameters
code
required
string

The code from the OAuth2 redirect. The system validates this code and exchanges it for a token.

Example: code=84b1a729-63e3-11e6-a0fb-bfcf357fd76d
redirect_uri
required
string

The redirect URI query argument that the system sent to the initial OAuth2 authentication endpoint.

Example: redirect_uri=https://hostname.example.com:2087/
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
get/ticket_validate_oauth2_code
Request samples
https://hostname.example.com:2087/cpsess##########/json-api/ticket_validate_oauth2_code?api.version=1&code=84b1a729-63e3-11e6-a0fb-bfcf357fd76d&redirect_uri=https%3a%2f%2fhostname.example.com%3a2087%2f
Response samples
application/json
{
  • "metadata": {
    • "command": "ticket_validate_oauth2_code",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}