Download the PHP package shongpon/yii2-eauth-ega-th without Composer
On this page you can find all versions of the php package shongpon/yii2-eauth-ega-th. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shongpon/yii2-eauth-ega-th
More information about shongpon/yii2-eauth-ega-th
Files in shongpon/yii2-eauth-ega-th
Package yii2-eauth-ega-th
Short Description Yii2 EAuth Extension. EAuth allows to authenticate users with accounts on other websites (Google, Facebook, Twitter, etc).
License New BSD License
Homepage https://github.com/Nodge/yii2-eauth
Informations about the package yii2-eauth-ega-th
Yii2 EAuth extension
EAuth extension allows to authenticate users with accounts on other websites. Supported protocols: OpenID, OAuth 1.0 and OAuth 2.0.
EAuth is an extension to provide a unified (does not depend on the selected service) method to authenticate the user. The extension itself does not perform login, does not register the user and does not bind the user accounts from different providers.
- Demo
- Demo project
- Installation
- Version for yii 1.1
Why own extension and not a third-party service?
The implementation of the authorization on your own server has several advantages:
- Full control over the process: What will be written in the authorization window, what data we get, etc.
- Ability to change the appearance of the widget.
- When logging in via OAuth, it is possible to invoke methods on the API.
- Fewer dependencies on third-party services - more reliable application.
The extension allows you to:
- Ignore the nuances of authorization through the different types of services and use the class based adapters for each service.
- Get a unique user ID that can be used to register the user in your application.
- Extend the standard authorization classes to obtain additional data about the user.
- Work with the API of social networks by extending the authorization classes.
- Set up a list of supported services, customize the appearance of the widget, use the popup window without closing your application.
Extension includes:
- The component that contains utility functions.
- A widget that displays a list of services in the form of icons and allowing authorization in the popup window.
- Base classes to create your own services.
- Ready to authenticate via Google, Twitter, Facebook and other providers.
Included services:
- OpenID:
- Yahoo
- Steam
- OAuth1:
- OAuth2:
- Live
- GitHub
- Yandex (ru)
- VKontake (ru)
- Mail.ru (ru)
- Odnoklassniki (ru)
Resources
Requirements
- Yii 2.0 or above
- curl php extension
- LightOpenId
- PHPoAuthLib
Installation
This library can be found on Packagist. The recommended way to install this is through composer.
Edit your composer.json
and add:
And install dependencies:
Usage
Demo project
The source code of the demo is available here.
Basic setup
Configuration
Add the following in your config:
User model
You need to modify your User model to login with EAuth services. Example from demo project:
Then you can access to EAuth attributes through:
Controller
Attach OpenID Controller behavior to disable CSRF validation for OpenID callbacks. Or you can disable CSRF validation by yourself.
Add the following to your Login action:
View
Extending
To receive all the necessary data to your application, you can override the base class of any provider.
Base classes are stored in @eauth/src/services
.
Examples of extended classes can be found in @eauth/src/services/extended/
.
After overriding the base class, you need to update your configuration file with a new class name.
Working with OAuth API
You can extend base classes with necessary methods and then write something like this:
Example of an API call method:
API calls are performed if the current user has a valid access token (saved during the authentication). You can save access_token to your database by using custom token storage in your config:
Translation
To use translations, add the following in your config:
Available translations can be found in @eauth/src/messages
.
License
The extension was released under the New BSD License, so you'll find the latest version on GitHub.
All versions of yii2-eauth-ega-th with dependencies
lib-curl Version *
yiisoft/yii2 Version *
lusitanian/oauth Version ~0.3.0
nodge/lightopenid Version ~1.1.0