Recently I added a twitter feed to this website. You can see it on the right side of this page! I had to do some digging to find the configuration items to achieve it. I am going to describe what those things were and how can we find the required information.
Though I am writing about adding twitter feed to WordPress specifically, you can extend this to any kind of plugins.
Consumer Keys and Authentication Tokens
In order to add a twitter feed to your website in WordPress, you need to use a plugin. In fact this is not just limited to WordPress. There are several plugins and widgets that you can use to add a twitter feed or twitter timeline or posts to your webpage. What I use is called an “Extra” theme from https://www.elegantthemes.com/. This theme provides me with a widget called RECENT TWEETS. This widget allows me display latest tweets on my website.
Now in order to configure this widget or in that matter any other lug in or widget, you would need a few basic things –
1. Consumer Keys which consists of API Key and API Secret
2. Authentication Tokens which consists of Bearer Token, Access Token and Access Secret
For most of the plugins or widgets, you would need these to configure them. In my case, as you can see, I needed everything but the Bearer Token. So, how do we get these information? Let me give a step by step guide to get these information from Twitter.
Generating API Key & Secret and Access Token Key & Secret on Twitter
Step 1: In order to get those keys you need to use the Twitter developer portal. Go to https://developer.twitter.com/. If you already have access then Sign In and go to step 3
Step 2: If you don’t have a twitter developer portal access, then click on Apply on the top right corner of the page. Click on “Apply for a developer account”, It will ask you to log in using your twitter account. Next, it will ask you to select the primary reason – select “Doing something else” (select this option so that they don’t try to provide specific options for the reason you select). Provide the relevant information in the next few pages. After completing these steps you should have developer access.
Step 3: If you are logging in for the very first time, you would be prompted to provide a App Name and click on Get keys. This should take you to a page with some keys displayed. You can keep the keys, but don’t worry, you will be able to View the Keys later. Click on Skip to dashboard
For those who already have developer access, you can directly go Overview and click the + Create App and do the above steps.
Step 4: Once the app is created, click on the Keys and tokens to get tot he page with the key information.
Step 5: You can click on View Keys in the Consumer Keys section to view the API Key and the API Key Secret. Click on the Generate button on the Access Token and Secret section to generate the Access Token and Access Token Secret. You have to store these keys if you plan to use them. These will not display again.
So this is how you generate Keys and Secrets for Twitter. Like I mentioned before these can be used in various widgets and plugins. you can use them directly in your custom html code too.
Hope this was helpful!