How do you get toolkit to correctly link up with the current user?

Toolkit does not seem to establish a relationship between the currently logged in user on a machine and a user account in Shotgun:

  • Publishes are created by the Toolkit User instead of the artist who published them
  • The context.user property is None
  • The API call sgtk.util.login.get_current_user(tk) returns None 

How do I get Toolkit to detect the current user?

Thank's for your help!


  • 0
    Manne Öhrström

    Hello! Great question!

    What is your computer/machine login? Does it match your Shotgun login?

    Our current default behavior is that Toolkit will prompt for a login and password and use the user corresponding to that login.  If you switch to script based connections to Shotgun, the default behavior is to try and correlate the computer/machine login with the Shotgun login when setting the user in Shotgun. If your logins don't match, we fall back to setting the user to be the Shotgun Script (aka "Toolkit 1.0"). This behavior can be controlled/overridden with this core hook:


    The default implementation just passes through the computer/machine login. If you have some sort of "formula" for going from the user currently logged on to a machine to a shotgun login, you can customize the above hook. We have also encountered windows clients in the past who are all logged in as the administrator user - if this is the case in your studio, perhaps you could set an environment variable containing the current shotgun user and this can be picked up by the hook (although we would probably also strongly recommend creating account for all individual users on the machines!). For more information about how to override a core hook, check out the documentation here:


    Longer term, we're thinking we should change this behavior, at least if you launch from Shotgun, so that you get that user no matter what. This would leave the command line as a potential edge case, since there's no Shotgun login to grab in that case. The other thing that is likely to happen in the future is a mechanism to "log in" to Toolkit in Maya/Nuke/etc. similar to the way you "log in" to Screening Room for RV. 

  • 0

    I'm having the same problem but I do not understand how can I call user name form current SG Chrome login or SG desktop. Also, I do not understand why it is not set by default since you log in to SG Desktop anyway and the application know who you are.

  • 0
    Manne Öhrström


    Great question Kirill!

    The Shotgun Desktop is still pretty new and we haven't had time to update all of Toolkit to take advantage of all the new possibilities that are now given by the Desktop. One of those things is to carry the authentication across from the Desktop into other applications. 

    The Shotgun Desktop uses a special Toolkit framework to securely manage logins - it's part of the public toolkit distribution and you can find it here - https://support.shotgunsoftware.com/entries/95443517

    The plan going forward is to hook up the various engines we have with this new login framework and gradually change over from basing the notion of the current user from the current user-name based approach to be driven by the login. This will still be done using our default login hook so you can configure it to use any mechanism you like. In fact, some of our more technical clients have already started to hook up the login framework with that hook, meaning that engines will prompt you for a login and password as you start them up. We hope that this change will make it into the default configs and the official distribution of toolkit too!



Please sign in to leave a comment.