Create a temporary user session
Changed onThis function creates a new temporary user session for a specified service. This allows users with WHM access to log in to third-party applications (for example, billing systems) without storing the account password.
Note:
-
The system destroys the temporary session after 15 minutes of inactivity.
-
For more information about the Single Sign On feature, read our Guide to API Authentication documentation.
-
On accounts that use the Meridian theme, this function can stage a handoff request for a separate website-builder shell to read once the session's interface loads.
Request
- Base URLhttps://whm-server.tld:2087/json-api
- AuthHTTP basic
Query parameters
The session's service.
The session's cPanel account username or a valid email address.
The cPanel or WHM application to which the session will link. This parameter defaults to a blank string, which redirects the user to the cPanel Home interface.
- A valid application name, to link the session to an application.
- An invalid application name, to create the session but not link it to an application.
The session's security token.
The session's locale. This parameter defaults to the Server Locale setting in WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings).
Note:
- If you specify a locale, the server sends a cookie to your browser with that locale setting. The cookie expires after one year.
- Users can change the locale with the language options at the bottom of the login interface.
The post-login destination to hand the user off to, for example a website builder such as nova, nova-wordpress, or sitejet.
Note:
- This parameter's value may contain only lowercase letters and numbers, in hyphen-separated segments. It may not begin or end with a hyphen, or contain two consecutive hyphens, and it may not exceed 64 characters.
- This parameter requires the service parameter's value to be cpaneld.
- This function accepts any well-formed value for this parameter without checking it against a registry of known destinations. The builder shell falls back to its normal routing when this parameter's value names a destination the account cannot reach, for any reason.
- This function stages the handoff request only when the user parameter's account uses the Meridian theme. On other themes, the function validates this parameter's value but discards it afterward.
- A later call for the same user parameter's account replaces any handoff request still pending from an earlier call.
- The url return field's value is the only way to redeem the staged request. It binds the request to the session that URL creates.
The hostname or IP address for the function to use in the url return. This parameter's value defaults to the server's hostname.
The prompt token to pre-populate the user's website-generation goals when logging into the Nova interface.
Note:
- This value must be base64-encoded.
- Maximum decoded length is 5000 characters.
A domain the cPanel account owns.
Note:
- A leading http:// or https:// is stripped, and the value is lowercased, before validation. An IP address is rejected.
- This parameter requires the service parameter's value to be cpaneld.
- When omitted, this parameter defaults to the account's main domain, but only when that domain is itself a syntactically valid domain name.
- Supplying this parameter's value without also supplying the post_login_landing parameter's value is validated and accepted, but this function does not use this parameter's value in that case.
Response
HTTP Request was successful.
Example response
{
"data": {
"cp_security_token": "/cpsess1234567890",
"expires": 1401993893,
"service": "cpaneld",
"session": "username:RFw6MUp9S8sRwTSgqaUJWUCq8ZQg2Zkopx5KaTHRNQXBfT3n8xvfBEF9JJC3iiwa",
"url": "https://example.com:2083/cpsess1234567890/login/?session=username:RFw6MUp9S8sRwTSgqaUJWUCq8ZQg2Zkopx5KaTHRNQXBfT3n8xvfBEF9JJC3iiwa&locale=fr"
},
"metadata": {
"command": "create_user_session",
"reason": "Created session",
"result": 1,
"version": 1
}
}Changes
- info
added the new optional
queryrequest parameterpost_login_landing - info
added the new optional
queryrequest parameterwebsite
- info