# Python API // 2-Factor Auth

**URL:** <https://community.shotgridsoftware.com/t/python-api-2-factor-auth/17985>\
**Category:** Pipeline Integrations\
**Tags:** python-api\
**Created:** [October 2, 2023, 12:40pm UTC](https://community.shotgridsoftware.com/t/python-api-2-factor-auth/17985 "2023-10-02T12:40:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BertST](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/bertst/32/3733_2.png) [@BertST](https://community.shotgridsoftware.com/u/BertST)\
**Post date:** [October 2, 2023, 12:40pm UTC](https://community.shotgridsoftware.com/t/python-api-2-factor-auth/17985/1 "2023-10-02T12:40:21Z")

</div>

We are encountering issues during human API authentication to the Shotgrid Python API with 2FA.

`sg = Shotgun("https://studio.shotgunstudio.com", login="loginemail", password="legacypasswoord"), auth_token="shotgridpersonalaccesstoken")`

I found topics here saying it worked for other people but the only api response we are getting is:

```auto

> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>ken="the auth token" 
> File "~/shotgun_api3/shotgun.py", line 715, in __init__
> self.config.session_token = self.get_session_token()
> File "~/shotgun_api3/shotgun.py", line 3235, in get_session_token
> rv = self._call_rpc("get_session_token", None)
> File "~/shotgun_api3/shotgun.py", line 3423, in _call_rpc
> self._response_errors(response)token="the auth token" ion 
> File "~/shotgun_api3/shotgun.py", line 3722, in _response_errors
> raise AuthenticationFault(sg_response.get("message", "Unknown Authentication Error"))
> shotgun_api3.shotgun.AuthenticationFault: Cant authenticate user 'email login'

```

* * *

The token has been connected on the SG user setting page

 ![Screenshot 2023-10-02 at 14.32.52](https://global.discourse-cdn.com/shotgunsoftware/original/2X/5/5f70653a89200ac9a78b139c7f2f3be42530f96a.png)

We also already tried using the 6-digit code from the authenticator app as auth\_token value without any succes.

Somebody has a clue why this is not working?

Thanks in advance,  
Bert

---

<div class="post-metadata">

**Author:** ![Ricardo\_Musch](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/ricardo_musch/32/405_2.png) [@Ricardo\_Musch](https://community.shotgridsoftware.com/u/Ricardo_Musch)\
**Post date:** [October 5, 2023, 2:58pm UTC](https://community.shotgridsoftware.com/t/python-api-2-factor-auth/17985/2 "2023-10-05T14:58:22Z")

</div>

You need to use the login name, not perse the email.

Old user accounts created before the move to Autodesk Identity will likelyu have a username that is not teh users email but just the first bit.

---

<div class="post-metadata">

**Author:** ![BertST](https://sea1.discourse-cdn.com/shotgunsoftware/user_avatar/community.shotgridsoftware.com/bertst/32/3733_2.png) [@BertST](https://community.shotgridsoftware.com/u/BertST)\
**Post date:** [February 15, 2024, 1:23pm UTC](https://community.shotgridsoftware.com/t/python-api-2-factor-auth/17985/3 "2024-02-15T13:23:26Z")

</div>

Hi Ricardo,

A while ago but forgot to mark this issue as solved.  
Thank you for pointing me into the right direction.

Greetings,  
Bert
