> For the complete documentation index, see [llms.txt](https://abelcheruvathoor.gitbook.io/autocdsl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://abelcheruvathoor.gitbook.io/autocdsl/setup/4.-configuring-2fa.md).

# 4. Configuring 2FA

Zerodha Kite web-based login no longer supports pin based authentication and is replaced by Two-Factor-Authentication (2FA), AutoCDSL has also updated with the same.

A minimal change in the lambda function python file is only required.

1. Navigate to your Zerodha Kite page, click on your profile followed by Settings -> Password & Security<br>
2. &#x20;Navigate to the bottom and you will see as below

<figure><img src="https://3955321061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7u3ewUbKREM72nYbdNg%2Fuploads%2Fgi8G3QpIKGJ25D8lAzHi%2FScreenshot%202022-09-28%20172624.png?alt=media&amp;token=1926c83e-2ca5-4e53-a4c9-5e57ef182a1e" alt=""><figcaption></figcaption></figure>

3\. Click on **Enable external TOTP**, you will need to perform a Kite Verification in which an email consisting of a security pin will be sent to your email. After verifying you will see the QR Code

4\. (I mportant Step ) You will have an option to copy the **Secret Key** as shown below , Click on 'Copy the key' and save it in a notepad/clipboard as we will use this later.

<figure><img src="https://3955321061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7u3ewUbKREM72nYbdNg%2Fuploads%2Fw9ErHNOnhmQDjTx8ZZym%2FScreenshot%202022-09-28%20173207.png?alt=media&amp;token=9a8c1451-16cf-48a2-a540-fe00f31d2dc0" alt=""><figcaption></figcaption></figure>

5\. If you are already using Google Authenticator you would know how to register Kite by in Google Authenticator, otherwise you can install the App from [here](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2\&hl=en_IN\&gl=US).

6\. Open Google Authenticator and select the + symbol following the 'Scan a QR Code' option.

<figure><img src="https://3955321061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7u3ewUbKREM72nYbdNg%2Fuploads%2FBsOsLVZx3VEQOemhG0HC%2Fimage.png?alt=media&amp;token=f97913b1-96e8-4618-969a-5a9582627241" alt=""><figcaption></figcaption></figure>

7\. Now you can enter the TOTP in the Google Authenticator App in the Kite windows as well as your login password to enable 2FA

<figure><img src="https://3955321061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7u3ewUbKREM72nYbdNg%2Fuploads%2FQFD18Nqk3AhHkLzMPH1u%2FScreenshot%202022-09-28%20173228.png?alt=media&amp;token=b04dce5a-6bc1-4a78-98e9-ccf5669fa93e" alt=""><figcaption></figcaption></figure>

8\. This enables the 2FA for Kite Web , now we need to update AutoCDSL deplyoment in the AWS Lambda to replace Kite PIN with TOTP based login. For that Navigate to AWS Console -> Lambda&#x20;

-> Functions -> AutoCDSL

9\. Under the `lambda_function` section replace the content of lambda\_function with the code from the GitHub repository below ( CTRL + C -> CTRL + V )\
<https://raw.githubusercontent.com/CasCard/AutoCDSL/main/lambda_function.py>

10 . Now your lambda function is reflected with the updated code. If you are not using the `configurations.py` and using environmental variables (recommended) you can skip this step .

Load your credentials with the secret key that you have copied earlier in the clipboard , you can add one more line in that file to use the secret key , it should look like this\
\
`KITE_SECRET="Your Kite 2FA Secret String"`

`for example KITE_SECRET="QHYPE7F72SWPK2EJDCSOWFKR4V73O43AFPK3FBNXMOEM6HCRHXRQ"`

<figure><img src="https://3955321061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7u3ewUbKREM72nYbdNg%2Fuploads%2FR6BjAroYPbOLUIs13ka1%2Fimage.png?alt=media&amp;token=2ef3c1fe-2e66-4b29-8d81-d7959b07c5fa" alt=""><figcaption></figcaption></figure>

11\. If you are using the environmental variable to load your credentials/passwords, you can add one more variable as KITE\_SECRET with the value you copied to the clipboard.

<figure><img src="https://3955321061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7u3ewUbKREM72nYbdNg%2Fuploads%2FJk042Z1g3ndjXAhM3uCj%2FScreenshot%202022-09-28%20181753.png?alt=media&amp;token=9082f9ad-034e-4b5d-a8e1-517bb8b933d7" alt=""><figcaption></figcaption></figure>

12\. Once you have updated the parameter navigate back to the `lambda_function.py` and click on **Deploy** followed by **Test**.

13\. Volia! We are done! Under the Execution result, you can see the TOTP at that instant and the Success message, you might have received a message from CDSL as well.&#x20;

<figure><img src="https://3955321061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7u3ewUbKREM72nYbdNg%2Fuploads%2FOVQnViCjPnypKr3Yb7Uk%2Fimage.png?alt=media&amp;token=f712f426-9bf1-4c99-a437-c429b9f26ea3" alt=""><figcaption><p>Success !</p></figcaption></figure>

{% hint style="info" %}
**Support and Donation** :tada:

If you found this documentation and setup useful for your investing journey, please do consider making a donation, so that I can make more contributions to the open source community and build powerful applications in terms of both software and hardware to serve our community.

UPI ID : abelcd.xyz\@paytm
{% endhint %}

<figure><img src="https://3955321061-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fp7u3ewUbKREM72nYbdNg%2Fuploads%2FYhiUzRUCQFYTLW4Y3cOI%2FWhatsApp%20Image%202022-09-28%20at%207.17.15%20PM%20(1).jpeg?alt=media&amp;token=a2b8af02-3b6d-4091-81b4-c0a71a52442e" alt=""><figcaption><p>UPI ID : abelcd.xyz@paytm</p></figcaption></figure>
