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

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

 

Description

This function validates a login token with the cPanel Store or a cPanel Market provider, and then returns access tokens.

Examples  


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/validate_login_token?api.version=1&url_after_login=http%3A%2F%2Fhostname.example.com%2Fredirectionlocation.cgi%3Fstate&provider=cPStore&login_token=1a676e6f-99fc-11e6-9ab6-e60a769b73bc
 XML API
https://hostname.example.com:2087/cpsess##########/xml-api/validate_login_token?api.version=1&url_after_login=http%3A%2F%2Fhostname.example.com%2Fredirectionlocation.cgi%3Fstate&provider=cPStore&login_token=1a676e6f-99fc-11e6-9ab6-e60a769b73bc
 Command Line
whmapi1 validate_login_token url_after_login=http:\/\/hostname.example.com\/redirectionlocation.cgi?state provider=cPStore login_token=1a676e6f-99fc-11e6-9ab6-e60a769b73bc


Notes:

  • Unless otherwise noted, 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.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{  
   "data":{  
      "payload":[  
         {  
            "access_token":"b7a6f029-99fc-11e6-a0bd-87581cb027ac",
            "refresh_token":"b7a7107f-99fc-11e6-a0bd-b46329164206"
         }
      ]
   },
   "metadata":{  
      "command":"validate_login_token",
      "version":1,
      "reason":"OK",
      "result":1
   }
}
 Output (XML)
<result>
    <metadata>
        <version>1</version>
        <reason>OK</reason>
        <result>1</result>
        <data>
            <payload>
                <access_token>b7a6f029-99fc-11e6-a0bd-87581cb027ac</access_token>
                <refresh_token>b7a7107f-99fc-11e6-a0bd-b46329164206</refresh_token>
            </payload>
        </data>
        <command>validate_login_token</command>
    </metadata>
</result>


Note:

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

   

Parameters

ParameterTypeDescriptionPossible valuesExample
providerstring

Required

The cPanel Store or cPanel Market provider's name.

  • cPStore
  • Any valid provider name.
cPStore
url_after_loginstring

Required

The location to which the cPanel Store or cPanel Market provider redirects the user's browser after they log in.

Any valid URL that includes a query component.http://hostname.example.com/redirectionlocation.cgi?state
login_tokenstring

Required

The login token to validate.

A valid login token.1a676e6f-99fc-11e6-9ab6-e60a769b73bc

 

Return

ReturnTypeDescriptionPossible valuesExample
payloadarray of hashes

An array of hashes of token information.

This hash includes the access_token and refresh_token returns.

 

access_token

string

The access token that the cPanel Store or cPanel Market provider returns after you log in.

The function returns this value in the payload array of hashes.

A valid access token.
b7a6f029-99fc-11e6-a0bd-87581cb027ac

refresh_token

string

The refresh token that the cPanel Store or cPanel Market provider returns after you log in .

The function returns this value in the payload array of hashes.

A valid refresh token.
b7a7107f-99fc-11e6-a0bd-b46329164206
  • No labels