Twitter authentication using PHP

Here I am going to explain twitter authentication using PHP.

Some time we need to get twitter userinfo like username, followers, and follows etc.

For this first you need to authenticate your app by redirect your website app users to twitter site, then redirect back to your site and get ‘oauth_token’.

Here i will use TwitterOAuth PHP Library

Step 1: Create an app and get info like ‘CONSUMER KEY’ and ‘CONSUMER SECRET’.

Click here https://github.com/abraham/twitteroauth to download library.

Step 3: Now first setup library and create an authentication url and then get token.

authorize.php

callback.php

Now get userinfo

Cheers 🙂

Gaurav Kumar

Hi, my name is Gaurav Kumar and I specialize in Computer Software industry. I have been working as a Software Developer from last 3+ years,and its my passion to learn new technology and sharing what I've learned.