prepareRemoteAuth()


This method is depreciated. We strongly recommend to use generateCheckoutUrl() method instead.

Method checks if customer account exists in Cleeng database, creates it if necessary, then returns URL that can be used to purchase an offer - without log in step required.

Only for enterprise accounts. Are you intrested in enterprise account? Please contact Us

Remote Authentication
Remote authentication is a process that allows integration between Cleeng customer accounts and users already registered on your website. It improves user experience by removing additional registration step on Cleeng Platform.

Remote authentication is initialized by making a call to prepareRemoteAuth() function. It checks if customer with given e-mail address exists in database (creating it if necessary), then returns purchase URL (offer ID should be passed in flowDescription parameter). At this moment you should redirect customer to returned URL. He will be automatically logged in, and purchase screen will show up.

Note: Link generated by prepareRemoteAuth() expires after 30 days or after first use.

Parameters:

Name Type Description
publisherToken string Your publisher token. To open enterprise account contact us
customerData object Required customer data
-email string Customer's email
-locale string Defines language and text formatting for the user. E.g. "en_US", "fr_FR"
-currency string Choose one: USD, EUR, GBP, CAD, AUD, NZD, SEK, DKK, NOK, TRL, ZAR, XOF
-country string 2-letter country code
-offerId string ID of the broadcaster's offer, e.g. A123123123_US
-redirectUri string URI to your content
flowDescription object No description
-email string Customer's email
-locale string Defines language and text formatting for the user. E.g. "en_US", "fr_FR"
-currency string Choose one: USD, EUR, GBP, CAD, AUD, NZD, SEK, DKK, NOK, TRL, ZAR, XOF
-country string 2-letter country code
-offerId string ID of the broadcaster's offer, e.g. A123123123_US
-redirectUri string URI to your content

- required parameter

Response Parameters:

Name Type Description
url string Custom URl for checkout

Request:

{
    "method": "prepareRemoteAuth",
    "params": {
        "publisherToken": "Xlrx-SjTLVMCsaRsOf2q2hvWKOlrF57yHknDRRRMX-13Fz-x",
        "customerData": {
            "email": "customer@email.com",
            "locale": "en_US",
            "currency": "USD",
            "country": "US"
        },
        "flowDescription": {
            "offerId": "",
            "redirectUri": ""
        }
    },
    "jsonrpc": "2.0",
    "id": 1
}

Response:

{
    "result": {
        "url": "https:\/\/cleeng.com\/auth\/2\/purchase?v=2.1&popup=1&remote_token=4a05f0bd07870f4cec92456a7a38452059a4a394:6484554b9bfd9b1609a51f3dcb0b3077d5e11ab6&redirectUri=https%3A%2F%2Fdev.cleeng.com%2Fjs-api%2F2.0%2Fdefault-channel.html&offerId="
    },
    "id": "1",
    "error": null,
    "jsonrpc": "2.0"
}

Example:

<?php
                            
    $customerData = array(
    'email' => 'customer@email.com',
    'locale' => 'en_US',
    'currency' => 'USD',
    'country' => 'US'
    );

    $flowDescription = array(
    'offerId' => 'R123123123_US',
    'redirectUri' => 'http://your-website.com/url'
    );

    $cleengApi = new Cleeng_Api();
    $cleengApi->setPublisherToken('VIJYHWzJEP4mt1DZThD7DV_FinBG0Yo3Q9oHfCFAjqA22jXP');//enterprise account required

    $remoteAuth = $cleengApi->prepareRemoteAuth($customerData, $flowDescription);

    header('Location: ' . $remoteAuth->url);
    
?>

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

Back to Customer API


We use cookies to ensure that we provide you the best service and website experience. Read our Cookie policy for more details.