Description

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.

Examples


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%2F
https://hostname.example.com:2087/cpsess##########/xml-api/ticket_validate_oauth2_code?api.version=1&code=84b1a729-63e3-11e6-a0fb-bfcf357fd76d&redirect_uri=https%3A%2F%2Fhostname.example.com%2F
whmapi1 ticket_validate_oauth2_code code=84b1a729-63e3-11e6-a0fb-bfcf357fd76d redirect_uri=https://hostname.example.com:2087/

 {
	"metadata": {
		"reason": "OK",
		"version": 1,
		"command": "ticket_validate_oauth2_code",
		"result": 1
	}
}
<result>
	<metadata>
		<reason>OK</reason>
		<version>1</version>
		<command>ticket_validate_oauth2_code</command>
		<result>1</result>
	</metadata>
</result>	

   

Parameters

ParameterTypeDescriptionPossible valuesExample
codestring

Required

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

An OAuth2 code.

84b1a729-63e3-11e6-a0fb-bfcf357fd76d

redirect_uri

integer

Required

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

A valid URL.

https://hostname.example.com:2087/

Returns

This function only returns metadata.