Retrieving OAuth Tokens

Note: Retrieving OAuth Tokens currently supported only for the Android Platform.

After twitter Authentication was successful, you can request OAuth Tokens as showed on the snapshot bellow:

string AccessToken 		 = AndroidTwitterManager.instance.AccessToken;
string AccessTokenSecret = AndroidTwitterManager.instance.AccessTokenSecret;


With this tokens you will able send request directly from the C#.  With this tokens you can use any method from the Twitter Rest API.

The Unity WWW class can be used for this. Approach how to create and format request is described here.


As alternative to creating your own client for query Twitter Rest API, you can use TW_OAuthAPIRequest class. Following code snippet shows how to query home_timeline with optional count param set to 1.

TW_OAuthAPIRequest request =  TW_OAuthAPIRequest.Create();

request.AddParam("count", 1);
request.OnResult += OnResult;

void OnResult (TW_APIRequstResult result) {
	Debug.Log("Is Request Succeeded: " + result.IsSucceeded);
	Debug.Log("Responce data:");

Warning: Such request can be performed only after user is Auntheficated. Otherwise TW_OAuthAPIRequest will not able to get access token and secret.

After response is received you can parse JSON data provided by twitter. 

With TW_OAuthAPIRequest  you can test your API implementation directly in the editor.But since we can not perform auth in the unity editor (only in real device) you need to specify static access token and secret. You can get token and secret for your personal twitter account directly in the twitter documentation, and specify it in the plugin settings. Step by step guide can be found bellow:

1) Open request documentation you would like to implement,  home_timeline for example.

2) Scroll down to the OAuth Signature Generator section, and pick your app from the dropdown. It will redirect you to the page where you can copy access token and secret for your account.

3) Open plugin editor settings under Windows â Mobile Social Plugin â Edit Settings. And copy access token and secret to the plugin editor settings as showed on the screenshot bellow

Note: Access Token and Secret specified under editor settings will be used only on the editor platform and only for testing purposes.