yii-eoauth

Yii Framework Extension. EOAuthUserIdentity class implements IUserIdentity Yii interface and the OAuth protocol to authenticate a user. Based on Google's software.

  • Owner: jorgebg/yii-eoauth
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

Introduction

EOAuthUserIdentity class implements IUserIdentity Yii interface and the OAuth protocol to authenticate a user.

Based on Google's software.

Flattr this git repo

###Resources

##Documentation

###Requirements

  • Yii 1.0 or above

###Installation

  • Extract the release file under protected/extensions/eoauth

###Usage

Use this sample actions for login/logout with Google:


    public function actionLogin() {

        Yii::import('ext.eoauth.*');

        $ui = new EOAuthUserIdentity(
                array(
                	//Set the "scope" to the service you want to use
                        'scope'=>'https://sandbox.google.com/apis/ads/publisher/',
                        'provider'=>array(
                                'request'=>'https://www.google.com/accounts/OAuthGetRequestToken',
                                'authorize'=>'https://www.google.com/accounts/OAuthAuthorizeToken',
                                'access'=>'https://www.google.com/accounts/OAuthGetAccessToken',
                        )
                )
        );

        if ($ui->authenticate()) {
            $user=Yii::app()->user;
            $user->login($ui);
            $this->redirect($user->returnUrl);
        }
        else throw new CHttpException(401, $ui->error);

    }



    public function actionLogout() {

        Yii::app()->user->logout();

        // Redirect to application home page.
        $this->redirect(Yii::app()->homeUrl);
    }

Set to load the extensions in the main.php (by DavidHHuan, thanx!)

'import'=>array(
    'application.models.*',
    'application.components.*',
        'ext.eoauth.*',
        'ext.eoauth.lib.*',
),

License

Some time ago I developed this extension for InDaHouseRulez SL. I no longer work there, but I still support the extension.

The extension was released under the MIT license, so I made a fork on GitHub, where you'll find the latest version:

https://github.com/jorgebg/yii-eoauth

Main metrics

Overview
Name With Ownerjorgebg/yii-eoauth
Primary LanguagePHP
Program languagePHP (Language Count: 1)
Platform
License:MIT License
所有者活动
Created At2011-04-28 00:00:10
Pushed At2015-09-08 08:57:51
Last Commit At2015-03-19 20:01:52
Release Count0
用户参与
Stargazers Count47
Watchers Count3
Fork Count14
Commits Count14
Has Issues Enabled
Issues Count4
Issue Open Count1
Pull Requests Count2
Pull Requests Open Count0
Pull Requests Close Count1
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private