You can find our user documentation at docs.cpanel.net.

Check out our new API beta site!

Child pages
  • UAPI Functions - Market::validate_login_token
Skip to end of metadata
Go to start of metadata

Description


This function validates a login token to a cPanel Market provider and returns an access token.

Examples


 cPanel or Webmail Session URL
https://hostname.example.com:2083/cpsess##########/execute/Market/validate_login_token?provider=cPStore&login_token=8765309&url_after_login=http%3A%2F%2Fhostname.example.com%2Fredirectionlocation.cgi%3Fstate


Note:

This example calls the UAPI function via a cPanel session. For more information, read our Guide to UAPI documentation. 

 LiveAPI PHP Class
$cpanel = new CPANEL(); // Connect to cPanel - only do this once.
 
// Validate the login token to the cPanel Market provider.
$validate = $cpanel->uapi(
    'Market', 'validate_login_token',
    array(
        'provider'        => 'cPStore',
        'login_token'     => '8675309',
        'url_after_login' => 'http%3A%2F%2Fhostname.example.com%2Fredirectionlocation.cgi%3Fstate'
 )
);


Note:

For more information, read our Guide to the LiveAPI System.


 LiveAPI Perl Module
my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
 
# Validate the login token to the cPanel Market provider.
my $validate = $cpliveapi->uapi(
    'Market', 'validate_login_token',
    {
        'provider'        => 'cPStore',
        'login_token'     => '8675309',
        'url_after_login'  => 'http%3A%2F%2Fhostname.example.com%2Fredirectionlocation.cgi%3Fstate'
 }
);


Note:

For more information, read our Guide to the LiveAPI System.


 Command Line
uapi --user=username Market validate_login_token provider=cPStore login_token=8675309 url_after_login=http%3A%2F%2Fhostname.example.com%2Fredirectionlocation.cgi%3Fstate


Notes:

  • You must URI-encode values.
  • username represents your account-level username.
  • For more information and additional output options, read our Guide to UAPI documentation or run the uapi --help command. 
  • If you run CloudLinux™, you must use the full path of the uapi command:

    /usr/local/cpanel/bin/uapi


 Output (JSON)
{
	"data": {
		"access_token": "8675309"
	},
	"messages": null,
	"errors": null,
	"status": 1,
	"metadata": {
		"transformed": 1
	}
}


Note:

Use cPanel's API Shell interface (cPanel >> Home >> Advanced >> API Shell) to directly test cPanel API calls.

   

Parameters

ParameterTypeDescriptionPossible valuesExample
providerstring

Required

The name of the cPanel Market provider.

A valid string.cPStore
login_tokenstring

Required

The login token for the cPanel Market provider.

A valid string.

8675309
url_after_login
string

Required

The url_after_login value that you sent to UAPI's Market::get_login_url function.

A valid URL.
http://hostname.example.com/redirectionlocation.cgi?state


Returns

Note:

This function may return additional information that the system does not currently use.

ReturnTypeDescriptionPossible valuesExample

access_token

string

The access token that returns from the code parameter after you log in with UAPI's Market::get_login_url function.

A valid scalar.8675309