Login SDK

Learn about Login SDK integration

Requirements

Login Page URL Cname Redirection

Before starting the process, the login page URL to be used must be redirected to lcname.zotlo.com as Cname.

Adding JavaScript File

In order to log in users with Zotlo Web SDK, the relevant javascript file must be added to the login screen as in the example below.

<script type="text/javascript" src="https://cdn.zotlo.com/tr/sdk.js?publicKey=yourPublicKey"></script>

Creating Login Button

After adding the JavaScript file, you can create the login button to be added to your page with the following methods:

  • If you want to create the login button manually, you need to add "Zotlo.login()" to the onclick event of the button element you will add to your html page as in the example below.

<button type=button" onclick=Zotlo.login();">SMS ile Giriş Yap
  • If you want to create the login button automatically, you need to add the following div element to your html page.

<div class="zotlo-login-buttons"></div>

Add the JavaScript Code

After creating your login button with one of the steps above, the following JavaScript code is required to be added to your page:

<script>
Zotlo.init({
publicKey: '',
redirectUrl:'',
loginButton: true
});
</script>

When users click on the "Sign in with SMS" button, pop-up verification screens open and when the verification process is completed, a token value is sent to the redirectUrl address defined in "Zotlo.init" with the GET method in order to receive subscription information.

With the token value sent to your RedirectUrl address, you can check whether there is user benefit or not by sending a request to the purchaseList API endpoint with the Access Key and Access Secret information of your application.

Access Key and Access Secret information will be sent by Zotlo onboarding team.

Development

If webhooks are defined in the application, you can regularly track the benefit status of the users and receive updates. If webhooks are not defined, the benefit status of the users will be sent to the application end at each login process. Session management of users who are logged in and whose benefits have expired should be carried out on the application end.

Example Request

curl --location --request GET 'https://api.zotlo.com/v1/purchase/list?token=***' \
--header 'AccessKey: ***' \
--header 'AccessSecret: ***' \
--header 'ApplicationId: **' \
--header 'Language: tr'

Successful Result

"meta": {
"requestId": "7198eab26992-REQ-60c0e6f255d65",
"httpStatus": 200
},
"result": [
{
"status": "active",
"realStatus": "active",
"subscriberId": "***",
"subscriptionType": "trial",
"startDate": "2021-05-27 14:44:46",
"expireDate": "2021-06-03 14:44:46",
"package": "aff.test",
"language": "tr",
"country": "TR",
"phoneNumber": null,
"originalTransactionId": "82d75b63-ee6a-41dd-a195- 2d3adbd8459f",
"cancellation": null,
"quantity": 1,
"pendingQuantity": 0,
"customParameters": []
}
]
}

Failed Result

{
"meta": {
"requestId": "app2.localdomain-REQ-5e7db66e67542",
"httpStatus": 400,
"errorMessage": "Kullanc abonelik profili bulunamadı.",
"errorCode": 400009
},
"result": []
}

Last updated