Determine if identity is shared

I’m not sure if this is a ‘bug’ in the dev rig, or if its intended behavior

Is there a way to determine if a user has shared their identity from the twitch.ext.onAuthorized callback? Using the following code, the onAuthrozied callback is called from a logged out user view:

(function () {
    function connect(auth) {
        Twitch.ext.rig.log('connecting');
        // rest of EBS connection code
    }

    Twitch.ext.onAuthorized(connect);

    document
        .getElementById('logon')
        .addEventListener('click', () => {
            Twitch.ext.actions.requestIdShare();
        });
})();
1 Like

window.Twitch.ext.viewer.isLinked is the most effective see also Reference | Twitch Developers

window.Twitch.ext.actions.requestIdShare(); will not work in the rig as it doesn’t have a “Twitch Session” to use to pop the popup.

The rig will populate parameters as defined by the settings of the view. And a view cannot change “state”

State changes such as changing from not isLinked to isLinked is best tested on the Twitch Website itself

1 Like

Thank you. I understand that the rig doesn’t change state or the such. I just didn’t expect .onAuthorized() to trigger for a user not logged into a twitch account.

onAuthorized means “heres a JWT you can use” and “the extension has finished loading and the Twitch JS Helper is read”

So it fires always at page load and periodicially if you leave the page open long enough (around once per hour) as the JWT is refreshed/regenerated.

1 Like