HybridAuth library (v2, v3) for CodeIgniter 3.x
HybridAuth library for CodeIgniter 3.x
CodeIgniter-HybridAuth v1
CodeIgniter-HybridAuth v2
If you're familiar with composer (recommended :+1:):
application
and run the following command:composer require hybridauth/hybridauth
application/config.php
and set composer_autoload
to TRUE
:$config['composer_autoload'] = TRUE;
Alternatively, you can:
application/third_party/hybridauth
folderOk, now copy files from this repository into your project:
application/config/hybridauth.php
application/libraries/Hybridauth.php
application/controllers/Hauth.php
application/views/hauth
Good, now let's put http://<yourdomain.com>/index.php/hauth/window/<Provider ID>
as valid Callback URL
in your provider application.
e.g for Facebook provider:
https://developers.facebook.com/apps/YOUR_APP/fb-login
http://<yourdomain.com>/index.php/hauth/window/facebook
as Valid OAuth redirect URIs
Finally, configure the providers inside the application/config/hybridauth.php
file
:tada: :tada: :tada:
http://<yourdomain.com>/index.php/hauth
to see enabled providers.Hauth
controller to your fits.First, you should load HA library into the system
$this->load->library('hybridauth');
To create a login link you can use
anchor('hauth/window/facebook', 'Facebook');
Or just put this link to your html code.
<a href="http://www.example.com/index.php/hauth/window/facebook">Log in with Facebook</a>
To access HA instance use $this->hybridauth->HA
// Login into facebook.
$adapter = $this->hybridauth->HA->authenticate('Facebook');
// Get user profile.
$profile = $adapter->getUserProfile();
It's recommended to use Hauth controller (/index.php/hauth).