> For the complete documentation index, see [llms.txt](https://iframe-doc.quantsapp.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://iframe-doc.quantsapp.com/partner-authentication/verified-partner.md).

# 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:<br>

### STEP 1 : Get the partner Encryption Salt and name &#x20;

To get these details, email us at <partner-support@quantsapp.com>

### STEP 2:  Encrypt user info with the above salt

The user info has to be a json object with the following keys:<br>

<table><thead><tr><th width="188">Key</th><th>Value</th></tr></thead><tbody><tr><td>email</td><td>User's email Id. (eg. "email": "xyz@gmail.com")</td></tr><tr><td>epoch</td><td>Epoch time in string. (eg. "epoch": "1671627013")</td></tr><tr><td>country</td><td>Country code (eg. "country": "in")</td></tr><tr><td>app_type</td><td>This has to be set "o" for all cases.</td></tr><tr><td>mobile</td><td>User's mobile number prefixed with country code. (eg. "mobile": "91-3331112221")</td></tr><tr><td>name</td><td>User's name. (eg. "name": "Rahul Biswa")</td></tr></tbody></table>

{% hint style="info" %}
NOTE:  The above json object has to be stringified and right justified (256) encoded before encryption.
{% endhint %}

The above string has to be then encrypted using AES encption with mode ECB and the salt provided.

{% code overflow="wrap" %}

```json
// SAMPLE REQUEST
{
    "profile": "kTput%2Bo39q%2F5L3vBVUEbUpE6brfqN%2Fav%2BS97wVVBG1KROm636jf2r%2Fkve8FVQRtSkTput%2Bo39q%2F5L3vBVUEbUpE6brfqN%2Fav%2BS97wVVBG1KROm636jf2r%2Fkve8FVQRtSkTput%2Bo39q%2F5L3vBVUEbUjsnfweifwfwif3weJFWSwweSXvLd1yp9mhGEOpBp6dXIp4V3vfblSV5nFxFsFptaUBA6h0f7X1XIEq6kZi2g6W2wFYtY32MkEuVMgCF27mGbyVVXKYUjyNX8XRHVJyqznsvvXWYPkORwNZk8nhcaX%2FpckYFez%2B%2B48F1xHKnSxeNjJLUbVwxa9Ju90%2BMOWHQ%3D%3D"
}
```

{% endcode %}

### STEP 3:  POST request for eToken

URL: [https://partners.quantsapp.com/login/:partner\_code](#undefined)

Body: The body will contain a JSON object with the following keys:

<table><thead><tr><th width="249.33333333333331">Key</th><th>Value</th></tr></thead><tbody><tr><td>profile</td><td>This will contain the encrypted string from STEP2</td></tr></tbody></table>

<mark style="color:green;">`POST`</mark> `https://partners.quantsapp.com/login/`

#### Path Parameters

| Name                                            | Type   | Description                                            |
| ----------------------------------------------- | ------ | ------------------------------------------------------ |
| partner\_code<mark style="color:red;">\*</mark> | String | This is the partner code given by quantsapp from STEP1 |

#### Request Body

| Name                                      | Type   | Description                                       |
| ----------------------------------------- | ------ | ------------------------------------------------- |
| profile<mark style="color:red;">\*</mark> | String | This will contain the encrypted string from STEP2 |

{% tabs %}
{% tab title="200: OK // API success response example" %}
{% code overflow="wrap" %}

```json
{
    "status": "1", 
    "msg": "success", 
    "etoken":           "lglyVGOlf8ohX8uWkgPMdR%2B9gNkSxYM6FZmWE7SixoUmEXKy2KMGFBmQMfy7RsaJQ3jNBcKOo4imgLvyb2btX03aZrD9Q75%2F4yDwtMXL0MMVwuAbf4GJnv7aUMNHTd5iwtLUe1jIN7IYYNzm7GICVmkpw8LbVY1DlGu0EBB%2F6bdnBbTCXyM%2FlYSiauiZ%2FX%2BwUtwuqcK6iNeQObTXjePTYLQ%3D%3D"
}
```

{% endcode %}
{% endtab %}

{% tab title="200: OK // Error response" %}

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

<pre class="language-json5" data-overflow="wrap"><code class="lang-json5">// API success response example
<strong>{
</strong>    "Status": 200 
    "Data": {
    "status": "1", 
    "msg": "success", 
    "etoken":                "lglyVGOlf8ohX8uWkgPMdR%2B9gNkSxYM6FZmWE7SixoUmEXKy2KMGFBmQMfy7RsaJQ3jNBcKOo4imgLvyb2btX03aZrD9Q75%2F4yDwtMXL0MMVwuAbf4GJnv7aUMNHTd5iwtLUe1jIN7IYYNzm7GICVmkpw8LbVY1DlGu0EBB%2F6bdnBbTCXyM%2FlYSiauiZ%2FX%2BwUtwuqcK6iNeQObTXjePTYLQ%3D%3D"
    }
   }
</code></pre>

ERROR CODES:

### CODE EXAMPLE:

{% code overflow="wrap" %}

```python
// 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'] = 'xyz@gmail.com'
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())
```

{% endcode %}

### 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>
