Invalid OAuth in game - works when testing in Postman

Hey! I’ve read through a number of topics on this subject but can’t find an answer that works for me.

I’m running a simple get helix/users query in my game to grab the player’s ID, and while testing it in Postman it works absolutely fine and the details are retrieved. As soon as it is run in my game though I get error 401 - any ideas?

        UnityWebRequest www = UnityWebRequest.Get("" + user.ToLower());
        www.SetRequestHeader("Authorization", bearer);
        www.SetRequestHeader("Client-Id", clientid);
        yield return www.SendWebRequest();

The ClientID and Bearer are brand new (and correct, hence it working in Postman).


What is the body of the response.

HTTP code is half the information.

This is what I get in Postman:

“data”: [
“id”: “83277609”,
“login”: “ibzy_”,
“display_name”: “Ibzy_”,
“type”: “”,
“broadcaster_type”: “affiliate”,
“description”: “Returning after a long hiatus, getting back into the swing of things with Splitgate, Phantom Abyss, and interactive classic DOOM streams. Enquiries:”,
“profile_image_url”: “”,
“offline_image_url”: “”,
“view_count”: 69522,
“created_at”: “2015-02-20T23:21:04Z”

And this is in my debug.log:

{“error”:“Unauthorized”,“status”:401,“message”:“Invalid OAuth token”}

The token used inside your app is invalid.

I’m using the exact same token, I literally copy pasted from my code to postman and it works outside the app

You sure your header is connectly formed with BearerSPACEthetoken

I am.

However, I am now working on a time machine to slap my past self. Added a debug.log(bearer) and got given a different token. Any guesses?

Yep, I left it as an open property and it was being overridden in Unity.

Thanks for your help, Barry