- Choosing a Library
- Registering with Providers
- Installing the HybridAuth Library
- Communicating with Twitter
- Conclusion
Registering with Providers
Most service providers do not just blindly allow any website or application to connect to and communicate with their system. This is a matter of control, as well as security, but it’s definitely prudent. Thus, in order to use Twitter, Facebook, LinkedIn, etc., you must first register your application with the corresponding site. Generally speaking, registering is free and only takes a few minutes, but you’ll need to have a user account for that site already. The HybridAuth library has links and basic instructions for registering with the various sites, but I’ll explain how to register your application with Twitter anyway, just to be clear.
- Head to https://dev.twitter.com/apps.
- Log in using your Twitter account.
- Click Create a New Application.
- In the following form, enter your application’s name and description. Both should be descriptive and meaningful, as those values will be seen by users.
- Still in the form, enter the URL of your website’s home page. Note that you must have a live site to communicate with most providers. You cannot do so from localhost.
- Enter the callback URL. For this example, that can just be an index.php or auth.php page on your site.
- Read, and agree to, the terms.
- Enter the captcha value.
- Click Create Your Twitter application.
Once you’ve completed these steps, you’ll see your application listed. Click on it to view, or change, your details. You will need your “Consumer key” and “Consumer secret” values from the Details page (see Figure 1) when you go to install and use the HybridAuth library (next).
Figure 1 The details for the application registered with Twitter.
If you know you want to connect to other providers, such as Facebook, repeat this process for each (again, the HybridAuth documentation comes with direct links).