The top thing (which is mine) refers to getting a users username/display name on the server
If you are on the server then you wouldn’t (generlaly) use helixToken as you are not in the front end any more you would use a Client Credentials token.
My Example is what you did before helixToken existed and needed to get the users profile, but is still a valid approach today.
So if you need a display name in the front end you can either
- use helixToken to get it in the front end
- make your front end call your backend and pass up the helixToken and the backend then uses that token to make the call, no need for any other token (Extension prefix)
- make your front end call your backend load/generate a client credentials token and do the lookup (Bearer prefix)
I think you are mixing/matching tokens/proceedures and getting confused.
If you are calling your server, ignore helixToken and have the server use a clientCredntials token, as my example shows, which uses the Bearer prefix
TLDR:
If you are generating a client cretentials token, the prefix is Bearer
The Extension prefix only applies if the token is the helixToken.
I suspect you are 401-ing becuase you generated a client Creds and using the Extension prefix.