Authenticate by OAuth

You can also authenticate by OAuth function instead of Basic Auth.

The OAuth function requires the environment below;

Register your client

First of all, you should register your client to Twitter.

Access then click “Register a new application”.
You can choose “Application Type” as you wish. If you want to use “tuitter4oauth.php” which is included in Tuitter as appendix, you should choose “Browser”.

After you save the client, you can get your “Consumer key” and “Consumer secret”.

Get your access key

Then you can get your access key and secret.
We describe the way of using tuitter4oauth.php here.

Copy tuitter4oauth.php from Tuitter directory to anywhere you can access by browser. Open the file by editor then put your consumer key and secret onto the first 2 rows.

$conskey = 'YOUR_CONSUMER_KEY';

After saving, access the page by your browser. Make sure you’ve logged in Twitter by your bot account.

You can see the confirmation page to connect your client. Click “Accept”.

Now, you can get your access key and access secret.

Create the instance of TuitterOAuth

Finally you can create the instance of TuitterOAuth.


The instance works completely same as Tuitter object.