Logging in using Twitter credentials
If we don't want to worry about storing the user's information and credentials, we could use OAuth to authenticate with another service. A popular service to use for logins is Twitter. With Laravel and the HybridAuth library, we can easily implement OAuth authentication with Twitter.
Getting ready
For this recipe, we need to have the HybridAuth package installed and set up as in the Setting up OAuth with the HybridAuth package recipe.
How to do it...
To complete this recipe, follow these steps:
Create a new app at https://dev.twitter.com/apps.
Get the Consumer Key and the Consumer Secret, and in the
app/config
directory, create a file named astw_auth.php
:<?php return array( "base_url" => "http://path/to/our/app/twauth/auth", "providers" => array ( "Twitter" => array ( "enabled" => true, "keys" => array ("key" => "CONSUMER_KEY", "secret" => "CONSUMER_SECRET") ) ) );
Create...