Our documentation is getting an overhaul! We would like your input! Click here to take a look at the beta launch of our new documentation site! Only cPanel & WHM version 82 documentation exists on our beta at this time. 84 will be added to the new site soon! Leave your feedback here: https://go.cpanel.net/docsfeedback
WHM API 1 Functions - ticket_validate_oauth2_code - Developer Documentation - cPanel Documentation
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

Warning:

You cannot use this method to call the function.

 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.