generateCustomerToken()


Allows to create customerToken when it expires or gets lost (by cookies deletion or browser change).
Customer has to be created prior by prepareRemoteAuth method or registerCustomer method.

Info: Enterprise account required. Contact us if you're interested about opening Enterprise account.

Parameters:

Name Type Description
publisherToken string Your publisher token. To open enterprise account contact us.
customerEmail string Email of customer to generate Token.

- required parameter

Response Parameters:

Name Type Description
token string Customer token used to identify the user

Error Codes:

Code Description
3 Invalid publisher token
5 Access denied
11 Invalid arguments

Request:

{
    "method": "generateCustomerToken",
    "params": {
        "publisherToken": "Xlrx-SjTLVMCsaRsOf2q2hvWKOlrF57yHknDRRRMX-13Fz-x",
        "customerEmail": "customer@email.com"
    },
    "jsonrpc": "2.0",
    "id": 1
}

Response:

[
    {
        "result": {
            "token": "A0vPK0gIkpkcV6egDjsi3C2ftU1NBqqaTuhZnimZgXo9IUis"
        },
        "id": "1",
        "error": null,
        "jsonrpc": "2.0"
    }
]

Example:

<?php
                            
    $customerEmail = 'some-customer@email.com';

    $cleengApi =  new Cleeng_Api();

    $cleengApi->setPublisherToken('Xlrx-SjTLVMCsaRsOf2q2hvWKOlrF57yHknDRRRMX-13Fz-x');
    $result = $cleengApi->generateCustomerToken($customerEmail);
    
?>

Remember! you can always check it by yourself using API Console - generateCustomerToken()

Back to Customer API