I use this code. It work in Unity 5.
First function work fine, second function not work.
private const string PostTweetURL = “https://api.twitter.com/1.1/statuses/update.json”;
private const string UsersLookupURL = “https://api.twitter.com/1.1/users/lookup.json”;
public static IEnumerator PostTweet(string text, string consumerKey, string consumerSecret, AccessTokenResponse response, PostTweetCallback callback)
{
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add(“status”, text);
// Add data to the form to post.
WWWForm form = new WWWForm();
form.AddField("status", text);
// HTTP header
var headers = new Dictionary<string, string>();
headers.Add("Authorization", GetHeaderWithAccessToken("POST", PostTweetURL, consumerKey, consumerSecret, response, parameters));
WWW web = new WWW(PostTweetURL, form.data, headers);
yield return web;
Debug.Log(web.bytes.Length.ToString());
Debug.Log(Encoding.UTF8.GetString(web.bytes));
}
public static IEnumerator GetUserFullInfo(string consumerKey, string consumerSecret, AccessTokenResponse response)
{
var parameters = new Dictionary<string, string>();
parameters.Clear();
var headers = new Dictionary<string, string>();
headers.Add("Authorization", GetHeaderWithAccessToken("GET", UsersLookupURL, consumerKey, consumerSecret, response, parameters));
var getInfo = "?screen_name=ITD_test";
WWW web = new WWW(UsersLookupURL + getInfo, new byte[0] { }, headers);
yield return web;
Debug.Log(web.bytes.Length.ToString());
Debug.Log(Encoding.UTF8.GetString(web.bytes));
}
This is examlpe of autorization data
OAuth realm=“Twitter API”,
oauth_consumer_key="",
oauth_nonce="",
oauth_signature_method=“HMAC-SHA1”,
oauth_timestamp="",
oauth_token="",
oauth_version=“1.0”,
oauth_signature="*"