For some of our custom toolkit apps, we use a customized wrapper for shotgun_api3.Shotgun class that has been modified and made thread-safe.
We run into issues when our session/auth tokens expire, because our implementation is not used by the wrapper with re-authentication logic that Toolkit provides with this module:
This and several other related modules have explicit warnings surrounding their use:
--------------------------------------------------------------------------------
NOTE! This module is part of the authentication library internals and should
not be called directly. Interfaces and implementation of this module may change
at any point.
--------------------------------------------------------------------------------
Is there perhaps a higher-level tank.authentication class that we could inherit from and extend to use our own ThreadSafeShotgun class when creating the Shotgun handle, so that we could take advantage of the re-authentication logic provided by the ShotgunWrapper?
The only thing that comes to my mind is to fork tk-core and implement it there so all the apps/engines/frameworks will be able to pick it up… then submit a PR.
As far as I know, the authentication side is tied into the inner workings of tk-core and there isn’t a way to have a hook to extend/override behaviours that you wanted here