Child pages
  • WHM API 1 Functions - ticket_validate_oauth2_code
Skip to end of metadata
Go to start of metadata

 

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


 JSON API
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
 XML API
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
 Command Line
whmapi1 ticket_validate_oauth2_code code=84b1a729-63e3-11e6-a0fb-bfcf357fd76d redirect_uri=https://hostname.example.com:2087/


Notes:

  • You must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command. 
  • We introduced this functionality in cPanel & WHM version 11.52.0.8.

 Output (JSON)
 {
	"metadata": {
		"reason": "OK",
		"version": 1,
		"command": "ticket_validate_oauth2_code",
		"result": 1
	}
}
 Output (XML)
<result>
	<metadata>
		<reason>OK</reason>
		<version>1</version>
		<command>ticket_validate_oauth2_code</command>
		<result>1</result>
	</metadata>
</result>	


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

   

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.