Getting Twitch UserID from onAuthorized auth.userid instead of auth.token

If someone could give some advice, I have ‘Request Identity Link’ checked on my extension and the document says ‘Once the viewer accepts your request to share his Twitch identity, his numeric Twitch ID is provided in the Extension Helper’s onAuthorized() callback function.’
Up until now i have been using the JWT token to get the Twitch ID (numeric) from, but recently i tried to get that ID from auth.userId. Tried refreshing, being on another channel, doesn’t make a difference to the auth.userid.

window.Twitch.ext.onAuthorized((auth: any) => {
Without granting permissions: auth.userId = “Uxxxxxxxxxxxxxx_xxxxx”
After granting permissions: auth.userId: “U_xxxxxxx_xxxxxxxxxxx”

I can get the twitchid from the token using this function:

function parseJwt (token: string): { channel_id: string, opaque_user_id: string, pubsub_perms: { listen: string[], send: string[] }, role: string, user_id?: string } {
var base64Url = token.split(’.’)[1];
var base64 = base64Url.replace(’-’, ‘+’).replace(’_’, ‘/’);
return JSON.parse(window.atob(base64));
};

but is there anyway to get it from auth.userid?

Thats the only way to do it. Parsing the JWT

U-references have no correlation with a TwitchID

Ah my mistake. I misunderstood the documentation. Thanks.