Skip to content
This repository has been archived by the owner on Jul 28, 2018. It is now read-only.
/ sauth Public archive

A Social authentication library for Zend Framework. Currently supported: facebook oauth 2.0, twitter oauth, foursquare oauth 2.0, vkontakte, mail.ru oauth 2.0, google open id, flickr, gowalla

Notifications You must be signed in to change notification settings

nnixaa/sauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

SAuth

This library is open source. Please help me by forking the project and adding to it.

Social authentication library for Zend Framework

Includes libraries for next social services:

  • Facebook
  • Twitter
  • Google
  • Foursquare
  • Vkontakte
  • Mail.ru
  • Flickr
  • Gowalla
  • Github
  • Skyrock.com

Getting Started

Simple example of authentication

public function authAction() {
    
    $parameters = array(
        'consumerId' => 'YOUR_CONSUMER_ID',
        'consumerKey' => 'YOUR_CONSUMER_KEY',
        'consumerSecret' => 'YOUR_CONSUMER_SECRET',
        'callbackUrl' => 'http://site.com/call_back_url',
        'scope' => array(
             'user_about_me', 'email',
        ),
    );
    
    $auth = Zend_Auth::getInstance();

    /**
     * or SAuth_Adapter_Twitter
     * or SAuth_Adapter_Foursquare
     * or SAuth_Adapter_Google
     * ...
     */
    $adapter = new SAuth_Adapter_Facebook($parameters);
    
    $result  = $auth->authenticate($adapter);
    
    if ($result->isValid()) {
        
        echo 'Success!';
        
    } else {
        
        echo 'Failed!';
        echo $result->getMessages();
        
    }
    
}

Library also retrieve user data from social service

public functoin indexAction() {
    
    $auth = Zend_Auth::getInstance();
    
    if ($auth->hasIdentity()) {
            
        /**
         * User data from service, such as login, email, id, name etc.
         */
        $userParameters = $auth->getIdentity();
    
    }
}

Demo

Demo

About

A Social authentication library for Zend Framework. Currently supported: facebook oauth 2.0, twitter oauth, foursquare oauth 2.0, vkontakte, mail.ru oauth 2.0, google open id, flickr, gowalla

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages