Skip to content

rahpt/CodeIgniter-HybridAuth

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeIgniter-HybridAuth

HybridAuth library for CodeIgniter 3.x

Dependencies

Installation

If you're familiar with composer (recommended 👍):

  • go to application and run the following command:
composer require hybridauth/hybridauth
  • then, go to application/config.php and set composer_autoload to TRUE:
$config['composer_autoload'] = TRUE;

Alternatively, you can:

  • download HybridAuth library
  • unpack the library into application/third_party/hybridauth folder
  • run composer install in the library directory (application/third_party/hybridauth)

Ok, now copy these files into your project:

application/config/hybridauth.php
application/libraries/Hybridauth.php
application/controllers/Hauth.php
application/views/hauth

OK, now let's put http://<yourdomain.com>/index.php/hauth/endpoint?hauth_done=<Provider ID> as valid Callback URL in your provider application.

e.g for Facebook provider:

  • go to https://developers.facebook.com/apps/YOUR_APP/fb-login
  • put http://<yourdomain.com>/index.php/hauth/endpoint?hauth_done=Facebook as Valid OAuth redirect URIs

Finally, configure the providers inside the application/config/hybridauth.php file

🎉 🎉 🎉

Quick Start

  • Visit http://<yourdomain.com>/index.php/hauth to see enabled providers.
  • Modify Hauth controller to your fits.

How to use

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).

To be done

  • Add support for HA 3.x
  • Add more demos / examples
  • Integrate with other libraries which provide User System.

About

HybridAuth library for CodeIgniter 3.x

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%