Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Extensions / Security & Authentication / HybridAuth

Single sign-on solution for quick login and registration on your Cotonti site using popular providers such as Google, Facebook, Twitter, Windows Live, Yahoo, MySpace, Vkontakte and lots more

 

HybridAuth is a self-hosted single sign on solution for PHP.

1. Features

  • Quick login via social networks and services.
  • Pre-filled fields on registration for new users.
  • Linking multiple accounts to your profile: users will be able to login with social accounts after linking them to their profile on site.
  • Auto-registration mode for sites which don't need standard registration and want to create accounts automatically from social networks.
  • No extra JavaScripts and third-party requests on every page, this plugin has minimal footprint.

See the list of supported auth providers here.

2. Demo

The plugin is enabled on this site. If you are logged out, you can see social buttons in the "Sign-in" dropdown at the top of the page and on the login page. If you are logged in, you can link social accounts in your profile.

3. Requirements

  • Cotonti >= 0.9.11
  • PHP extensions: curl, json

4. Installation

  1. Copy the plugin to your Cotonti plugins folder.
  2. Install it in Administration / Extensions.
  3. Edit plugins/hybridauth/conf/hybridauth.config.php according to HybridAuth User Guide.
  4. Go to Administration / Configuration / HybridAuth and click Update.
  5. Add {PHP|hybridauth_login} to your theme's login.tpl and {PHP|hybridauth_accounts} to your theme's users.profile.tpl. By default these widgets use templates called hybridauth.login.tpl and hybridauth.accounts.tpl accordingly, you can override them in your theme if you wish.

5. Configuration

This single sign-on solution is self-hosted, so you don't depend on any middleware providers but you have to obtain API keys for each service yourself. The basics are covered in HybridAuth User Guide and there are instructions for each provider in particular. For some providers you need to google how to register an app and get API keys yourself.

Every time you update hybridauth.config.php file you need to tell the plugin that there is a new provider available and it should create some database fields for it. To do so you should go to Administration / Configuration / HybridAuth and click Update. Configuration update forces hybridauth plugin to check for new providers and upgrade the database.

If you want to track user's real names in your database, it is recommended to add 2 extra fields to cot_users table in Administration / Other / Extra fields: firstname and lastname. They will be used to store names obtained from social profiles.

6. Templates

The plugin comes with two drop-in tags which help you to get going quickly: {PHP|hybridauth_login} and {PHP|hybridauth_accounts}. The first one renders large login buttons for your configured providers. The second one is used to link social accounts to user's profile.

You can customize those templates in your theme by copying hybridauth.login.tpl and hybridauth.accounts.tpl from plugin's tpl folder to your theme's plugins folder and editing them. You can also create more templates and pass them to these widgets as parameters, e.g. {PHP|hybridauth_login('hybridauth.my_login')} will use hybridauth.my_login.tpl as its template.

If you want to create direct login links for some providers, you can compose a URL this way: {PHP|cot_url('plug', 'e=hybridauth&a=login&provider=Provider_name')} where Provider_name is the name specified in hybridauth.config.php, such as Google or Facebook.

It is recommended to add a regular login form to your users.register.tpl for the following use-case: if the user has an account on your site and wants to log-in via provider but he has not linked the social account to his site account yet, then he needs to log in with his username and password and link the account in profile first.


1. quicksel  2012-12-25 18:13

Thanks: 0

error google conncet

Error:redirect_uri_mismatch

The redirect URI in the request: http://www.neohizmet.com/plugins/hybridauth/lib/?hauth.done=Google did not match a registered redirect URI

 

İstek Ayrıntıları

  • scope=https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
  • response_type=code
  • redirect_uri=http://www.neohizmet.com/plugins/hybridauth/lib/?hauth.done=Google
  • access_type=offline
  • display=page
  • client_id=667608486164.apps.googleusercontent.com

 

2. Twiebie  2012-12-25 20:50

Thanks: 0

It's better to open a topic in the forums for support, quicksel. :)

3. Trustmaster  2012-12-26 06:39

Thanks: 0

@quicksel you need to edit settings for your Client ID in https://code.google.com/apis/console/ and provide the URL:

See this screenshot: http://www.cotonti.com/datas/users/googleauth-settings_5.png

4. quicksel  2012-12-26 07:40

Thanks: 0

thanks..

5. quicksel  2012-12-26 07:52

Thanks: 0

openid error

http://www.neohizmet.com/ek/hybridauth.html?a=link&provider=OpenID

Fatal error: Uncaught exception 'Exception' with message 'OpenID adapter require the identity provider identifier 'openid_identifier' as an extra parameter.' in /home/neohizme/public_html/plugins/hybridauth/lib/Hybrid/Provider_Model_OpenID.php:48..........

6. Trustmaster  2012-12-26 18:24

Thanks: 0

Generic OpenID support is not provided yet, it will be added later on.

7. elfrenazo  2012-12-27 02:30

Thanks: 0

Gracias!!!

8. quicksel  2012-12-27 08:18

Thanks: 0

thank you

9. pieter  2012-12-27 12:13

Thanks: 0

Don't make the fault I did.
Click update in the configuration of the plugin, not on the plugin itselfs.

10. Kingsley  2012-12-29 01:10

Thanks: 0

when unlinking it directs you to an empty page. thought u should know..

11. D1mon  2014-05-16 07:56

Thanks: 0

http://docs.modx.pro/components/hybridauth/providers/ - информация о том, как создавать приложения провайдеров.

Total: 11, on page: 11

Only registered users can post new comments