# 2-Factor Auth error using python API

**URL:** <https://community.shotgridsoftware.com/t/2-factor-auth-error-using-python-api/13824>\
**Category:** Pipeline Integrations\
**Tags:** python-api\
**Created:** [October 21, 2021, 11:13am UTC](https://community.shotgridsoftware.com/t/2-factor-auth-error-using-python-api/13824 "2021-10-21T11:13:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![noimeta](https://avatars.discourse-cdn.com/v4/letter/n/dec6dc/32.png) [@noimeta](https://community.shotgridsoftware.com/u/noimeta)\
**Post date:** [October 21, 2021, 11:13am UTC](https://community.shotgridsoftware.com/t/2-factor-auth-error-using-python-api/13824/1 "2021-10-21T11:13:51Z")

</div>

I already setup a personal access token, but when I try using username and password to connect to shotgrid via python API, I got the following error:

```auto
shotgun_api3.shotgun.MissingTwoFactorAuthenticationFault: Missing argument for 2FA login

```

It happens only with some URLs. What could be wrong here?

---

<div class="post-metadata">

**Author:** ![patrick-hubert-adsk](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/patrick-hubert-adsk/32/257_2.png) [@patrick-hubert-adsk](https://community.shotgridsoftware.com/u/patrick-hubert-adsk)\
**Post date:** [October 22, 2021, 3:57am UTC](https://community.shotgridsoftware.com/t/2-factor-auth-error-using-python-api/13824/2 "2021-10-22T03:57:43Z")

</div>

Hi @noimeta

There are 2 types of 2FA:

- the one that is related to your Autodesk Identity account, which you use only when a Web browser is used to authenticate,
- the legacy ShotGrid 2FA, which is used for API connections using the Python or REST API, along with your legacy login and passphrase (NOT your Autodesk Identity username and password)

For sites where ShotGrid’s 2FA is setup and enabled, you need to provide the `auth_token` param along with the ShotGrid legacy login and passphrase. The auth token is the current 2FA value that Duo/Authenticator gives you for that account and site.

Hoping this helps,

-Patrick

---

<div class="post-metadata">

**Author:** ![noimeta](https://avatars.discourse-cdn.com/v4/letter/n/dec6dc/32.png) [@noimeta](https://community.shotgridsoftware.com/u/noimeta)\
**Post date:** [October 24, 2021, 6:24am UTC](https://community.shotgridsoftware.com/t/2-factor-auth-error-using-python-api/13824/3 "2021-10-24T06:24:08Z")

</div>

Thank you, Patrick.

That is what I’ guessing. Anyway, when I log in via a web browser, only the Autodesk 2FA. Does that mean the shotgrid 2FA is required only when logging in via API?

---

<div class="post-metadata">

**Author:** ![patrick-hubert-adsk](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/patrick-hubert-adsk/32/257_2.png) [@patrick-hubert-adsk](https://community.shotgridsoftware.com/u/patrick-hubert-adsk)\
**Post date:** [October 24, 2021, 7:57pm UTC](https://community.shotgridsoftware.com/t/2-factor-auth-error-using-python-api/13824/4 "2021-10-24T19:57:28Z")

</div>

Hi @noimeta

The ShotGrid 2FA was likely required for authentication on your site prior to the switch to Autodesk Identity. So that condition remained in effect for API calls.

There is currently a bug where the control for enabling/disabling ShotGrid-based 2FA is not visible. To have it turned off, you can open a support ticket so that we can turn it off for you.

-Patrick

---

<div class="post-metadata">

**Author:** ![noimeta](https://avatars.discourse-cdn.com/v4/letter/n/dec6dc/32.png) [@noimeta](https://community.shotgridsoftware.com/u/noimeta)\
**Post date:** [October 25, 2021, 1:59am UTC](https://community.shotgridsoftware.com/t/2-factor-auth-error-using-python-api/13824/5 "2021-10-25T01:59:53Z")

</div>

I see. Thank you very much, Patrick.
