Verified Partner
A verified partner can directly pass an etoken in the query params to auto login the user inside quantsapp embedded module. Below are the steps to generate the etoken:
STEP 1 : Get the partner Encryption Salt and name
To get these details, email us at [email protected]
STEP 2: Encrypt user info with the above salt
The user info has to be a json object with the following keys:
User's email Id. (eg. "email": "[email protected]")
epoch
Epoch time in string. (eg. "epoch": "1671627013")
country
Country code (eg. "country": "in")
app_type
This has to be set "o" for all cases.
mobile
User's mobile number prefixed with country code. (eg. "mobile": "91-3331112221")
name
User's name. (eg. "name": "Rahul Biswa")
The above string has to be then encrypted using AES encption with mode ECB and the salt provided.
// SAMPLE REQUEST
{
"profile": "kTput%2Bo39q%2F5L3vBVUEbUpE6brfqN%2Fav%2BS97wVVBG1KROm636jf2r%2Fkve8FVQRtSkTput%2Bo39q%2F5L3vBVUEbUpE6brfqN%2Fav%2BS97wVVBG1KROm636jf2r%2Fkve8FVQRtSkTput%2Bo39q%2F5L3vBVUEbUjsnfweifwfwif3weJFWSwweSXvLd1yp9mhGEOpBp6dXIp4V3vfblSV5nFxFsFptaUBA6h0f7X1XIEq6kZi2g6W2wFYtY32MkEuVMgCF27mGbyVVXKYUjyNX8XRHVJyqznsvvXWYPkORwNZk8nhcaX%2FpckYFez%2B%2B48F1xHKnSxeNjJLUbVwxa9Ju90%2BMOWHQ%3D%3D"
}
STEP 3: POST request for eToken
URL: https://partners.quantsapp.com/login/:partner_code
Body: The body will contain a JSON object with the following keys:
profile
This will contain the encrypted string from STEP2
POST
https://partners.quantsapp.com/login/
Path Parameters
partner_code*
String
This is the partner code given by quantsapp from STEP1
Request Body
profile*
String
This will contain the encrypted string from STEP2
{
"status": "1",
"msg": "success",
"etoken": "lglyVGOlf8ohX8uWkgPMdR%2B9gNkSxYM6FZmWE7SixoUmEXKy2KMGFBmQMfy7RsaJQ3jNBcKOo4imgLvyb2btX03aZrD9Q75%2F4yDwtMXL0MMVwuAbf4GJnv7aUMNHTd5iwtLUe1jIN7IYYNzm7GICVmkpw8LbVY1DlGu0EBB%2F6bdnBbTCXyM%2FlYSiauiZ%2FX%2BwUtwuqcK6iNeQObTXjePTYLQ%3D%3D"
}
// API success response example
{
"Status": 200
"Data": {
"status": "1",
"msg": "success",
"etoken": "lglyVGOlf8ohX8uWkgPMdR%2B9gNkSxYM6FZmWE7SixoUmEXKy2KMGFBmQMfy7RsaJQ3jNBcKOo4imgLvyb2btX03aZrD9Q75%2F4yDwtMXL0MMVwuAbf4GJnv7aUMNHTd5iwtLUe1jIN7IYYNzm7GICVmkpw8LbVY1DlGu0EBB%2F6bdnBbTCXyM%2FlYSiauiZ%2FX%2BwUtwuqcK6iNeQObTXjePTYLQ%3D%3D"
}
}
ERROR CODES:
CODE EXAMPLE:
// SAMPLE python code
import requests
import json
from Crypto.Cipher import AES
from urllib.parse import quote
import base64
import time
# Partner api call
salt = b'{your salt key provided by quantsapp}'
event = dict()
epoch = str(int((dt.datetime.utcnow() - dt.datetime(1970,1,1)).total_seconds()))
payload = dict()
payload['epoch'] = epoch
payload['country'] = 'in'
payload['app_type'] = 'o'
payload['mobile'] = '91-1112221111' #format country_code-number for eg. 91-1234567890
payload['email'] = '[email protected]'
payload['name'] = 'client name'
payload_b = json.dumps(payload).encode()
n_data = len(payload_b)
rj = math.ceil(n_data / 16) * 16
cipher = AES.new(salt, AES.MODE_ECB)
encrypted_payload = base64.b64encode(cipher.encrypt(payload_b.rjust(rj))).decode()
event['profile'] = encrypted_payload
url = 'https://partners.quantsapp.com/login/{#partner code provided by quantsapp}'
response = requests.post(url,json=event)
print(response.json())
Few Example Urls:
https://iframe.quantsapp.com/option-chain/NIFTY?eToken=liuyVGOlf8ohX8tWkgPMdR%2B9gNkSxYM6FZmWE7SixoUmEXKy2KMGFBmQMfy7RsaJQ3jNBcKOo7imUPvyy2btX07aZPD9Q75%2F4yDwtMXL0MMVxLf48EzMhPdF7z6lHzjOrtuUe1jIN0IYYKgm7GICVmjZvsVFOCKzIvqAj7hqSeW%2FBiTCXyM%2FliSiaoiZ%2FX%2BrUkcvr693CgbyNJ24EcQIRWw%3D%3D
https://iframe.quantsapp.com/option-gain?eToken=liuyVGOlf8ohX8tWkgPMdR%2B9gNkSxYM6FZmWE7SixoUmEXKy2KMGFBmQMfy7RsaJQ3jNBcKOo7imUPvyy2btX07aZPD9Q75%2F4yDwtMXL0MMVxLf48EzMhPdF7z6lHzjOrtuUe1jIN0IYYKgm7GICVmjZvsVFOCKzIvqAj7hqSeW%2FBiTCXyM%2FliSiaoiZ%2FX%2BrUkcvr693CgbyNJ24EcQIRWw%3D%3D
Last updated