Ayon nuke publish shotgrid login error

The workflow on how to fill out the SG user login is currently a bit of an unsolved issue in Ayon and we should find out a good way to cover the flexibility that each studio might choose to provide and at the very least document how to get it to work. In our case we hated the login dialog for SG in the OP integration of SG because it was redundant to ask the user for yet another login and the password credentials didn’t really work with 2FA (and it was completely broken in OP anyway as the code to check credentials didn’t even run https://github.com/ynput/OpenPype/blob/edfc7156b078b808b5fba9485bde4f1b4036501a/openpype/modules/shotgrid/tray/credential_dialog.py#L151) so I completely removed the need for that and just set on the general environment (in Ayon it would be under the core addon I believe) the login env var (AYON_SG_USERNAME or whatever logic to fill up the user session on this plugin https://github.com/ynput/ayon-shotgrid/blob/78fc8e597721324245f02ae5126fd3813e85408d/client/ayon_shotgrid/plugins/publish/collect_shotgrid_session.py#L48) by pointing the env var to {USER} as that env var exists on all of our workstations as soon as the artist logs in. Then because of the use of the SG API key with write permissions you can make any publish as it was that given user.

For Ayon we could probably make it so it uses the same username as whatever user is logged in Ayon as long as those match in SG… although you’d have to be careful in farm workflows where the Ayon login might not be the same… that’s why using an env var is easier to control locally and the farm.

Anyway, hope this helps you a bit to troubleshoot a bit more and the Ynput team can provide a better mechanism, I can try share more details tomorrow on how I set it up in my fork of ayon-shotgrid to get it to work there too

something like the equivalent of this https://github.com/fabiaserra/OpenPype/blob/release/alkemyx-next-minor/openpype/modules/shotgrid/plugins/publish/collect_shotgrid_session.py#L80

Hello @fabiaserra, thanks for your thoughtful response. Thought I sent this but it was sitting here… in any case, I started building my own SG connection outside of OP. Cheers!