Shotgrid authentication failed

Hi,

I’ve a “user restricted config” which I need to use in my bootstrap script. (I could have used script user but then I don’t get the “user restricted config”) .

So I’m using this

import sgtk
authenticator = sgtk.authentication.ShotgunAuthenticator()
authenticator.clear_default_user()
user = authenticator.get_user()
sgtk.set_authenticated_user(user)

the terminal keeps throwing “cannot authenticate user” error and keeps asking for credentials. FYI same credential works in “sgDesktop ui”

Please help as this has become a problem for us.

Hi @Rahul

Are you using the python binary that came with SG Desktop ?

Could you also enable logging after your import sgtk and share the full output of your program, including the resulting error:

sgtk.LogManager().initialize_custom_handler()
sgtk.LogManager().global_debug = True

Thanks,

-Patrick

Hi @patrick-hubert-adsk

Thanks for quick reply, Yes Im using python3.7 binary came with shotgun. For privacy reasons I’ve removed the SG URL and login details. (FYI We have SG hosted internally). Here is the log

rahul@hh-5950x-016 /opt/Shotgun/Python3/bin$ ./python3.7 ~/sg_user_authenitcation.py

[DEBUG sgtk.core.log] Debug logging enabled. To permanently enable it, set the TK_DEBUG environment variable.

[DEBUG sgtk.core.log] Setting TK_DEBUG in the environment for this session. This ensures that subprocesses spawned from this process will inherit the global debug logging setting from this process.

[DEBUG sgtk.core.util.user_settings] Reading user settings from /home/rahul/.shotgun/preferences/toolkit.ini

[DEBUG sgtk.core.util.user_settings] Default site:

[DEBUG sgtk.core.util.user_settings] Default login:

[DEBUG sgtk.core.util.user_settings] SG proxy:

[DEBUG sgtk.core.util.user_settings] App Store proxy:

[DEBUG sgtk.core.util.user_settings] System proxy:

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/hernehill/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current user is ‘rahul’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/hernehill/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] No cached user found for rahul

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/hernehill/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current user is ‘rahul’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/hernehill/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current user is ‘rahul’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/hernehill/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] No cached user found for rahul

[DEBUG sgtk.core.authentication.shotgun_authenticator] No default user found.

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current host is ‘<shotgun URL’

[DEBUG sgtk.core.authentication.session_cache] Loading ‘/home/rahul/.shotgun/hernehill/authentication.yml’

[DEBUG sgtk.core.authentication.session_cache] Current user is ‘rahul’

[DEBUG sgtk.core.authentication.console_authentication] Requesting password on command line.

Please enter your login credentials.

Host [<shotgun URL]: <shotgun URL

[INFO tank.authentication.sso_saml2.core.utils] Infos for site ‘<shotgun URL’ not in cache or expired

[DEBUG tank.authentication.sso_saml2.core.utils] User authentication method for <shotgun URL: oxygen

Login [rahul]: my_login_email

Password (empty to abort):

[DEBUG sgtk.core.authentication.session_cache] Connecting to SG to generate session token…

[DEBUG sgtk.stopwatch.tank.authentication.session_cache] generate_session_token: 0.112043s

Login failed: Authentication failed: Can’t authenticate user ‘my_login_email’.

Please enter your login credentials.

Host [<shotgun URL]:

Hi @Rahul

Are you trying to use your Autodesk Identity credentials to authenticate with the API ?

Autodesk Identity credentials can only be used wen authenticating with a web browser.

To authenticate with the API, you need to use your ShotGrid login (which may happen to be your email… or not) and the passphrase that you have set (which would be your old ShotGrid-based password if you had an account prior to the switch to Autodesk Identity), You also need to set up a Personal Access Token (PAT).

Details are described here: Help

Hoping this helps,

-Patrick

My Shotgrid login and Autodesk Identity Credentials are same. I do not have old shotgrid-based password. I need to double check if I have PAT setup, if not then will do.

EDIT:- I have created Personal Access Token, but still no luck with script login

New update, after changing my shotgrid credentials, it did work!!!

Thanks you so much Patrick. You are AWESOME!!!

2 Likes