Manage2 Authentication Methods
Last modified: July 27, 2022
Overview
The Manage2 API supports HTTP or key-based authentication. Manage2’s client libraries use basic authentication over SSL by default. This method encodes the Manage2 username and password inside the HTTP request headers.
Authentication methods
The Manage2 API supports the following authentication methods:
Basic authentication
Basic authentication encodes the Manage2 username and password inside the HTTP request headers. You can authenticate with the following methods:
HTTP
When you call a Manage2 API script in a web browser, a dialog box will appear below the URL:
Enter the Manage2 username and password in the appropriate text boxes.
cURL
Use the curl -u
command to authenticate user accounts when you call the function via the command line. For example:
curl -u [email protected]:123456luggage https://manage2.cpanel.net/XMLgroupInfo.cgi
Perl
Use the cPanelLicensing
Perl module to authenticate to the user account. For example:
|
|
PHP
Use the require
PHP class with the cPanelLicensing
PHP Class to authenticate to the user account. For example:
|
|
Key-based authentication
Key-based authentication grants access to a limited subset of the account’s abilities without the account’s username and password. For security, the system limits keys to one IP address. You must register keys on the computer that runs the scripts.
-
It is possible to associate multiple keys to a single IP address.
-
You must associate a key with an IP address before using it.
Register a key
To register a key, perform the following steps:
- Use the Manage2 API Add a Pickup Phrase function to add a pickup passphrase.
- Call the Manage2 API Register Key-Based Authentication function. This function returns a 20 character key to use for subsequent API calls.
On subsequent API calls, pass this key as the apikey
parameter’s value. For example:
curl 'https://manage2.cpanel.net/XMLlicenseInfo.cgi?output=json&apikey=aFj1fKnYzW5lbD5KXFeVtLsM'
If you use key-based authentication, the Manage2 API provides a Cross-Origin Resource Sharing (CORS) header.