Twitter SDK for Unity: Bad Authentication Data, error code 215



So i am simply trying to get the user’s name. Not the screen_name, just the name that the user could change constantly. According to the docs, i could get it by retrieving the User Object which contains all the user’s data. The problem here is whenever i try to retrieve it using (“”), i always get the following error: {“errors”:[{“code”:215,“message”:“Bad Authentication data.”}]}.

Here i am using Unity SDK. Which after authentication gives me access to userName, authToken, and id.

i can’t find anything useful on the internet regarding this, since using Twitter API in a game is very rare.

This is the code that i am using at the moment:

    IEnumerator GetDisplayName(string userID)
        using (WWW www = new WWW("" + userID))
            yield return www;
            string json = www.text;

            yield return www;

            foreach (var item in json)

Note: i call this function after i successfully authenticate.

So is it even possible to do this in Unity? and if so, what am i doing wrong?

Any help is very much appreciated.


I’m personally not familiar with Unity and was able to successfully call the endpoint using Insomnia just now. Have you tried using another tool?


Well, i can. But it is different in Unity. Since all the user has to do is click on a “Connect” button, and it redirects the user to the game with a successful login. Here is where i do not know what to do any more.

Thank you for the reply.