2017 © Pedro Peláez
 

library hybridauth

hybridauth/hybridauth integration into Nette Framework

image

david/hybridauth

hybridauth/hybridauth integration into Nette Framework

  • Monday, August 8, 2016
  • by kastanekdavid
  • Repository
  • 1 Watchers
  • 0 Stars
  • 91 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Gutter\HybridAuth

This is hybridauth/hybridauth integration for Nette Framework., (*1)

Installation

The best way to install Gutter\HybridAuth is via Composer:, (*2)

$ composer require gutter/hybridauth

Usage

You can use the HybridAuth as an extension., (*3)

Configuration

First you have to set the extension up in config.neon., (*4)

extensions:
    hybridAuth: Gutter\HybridAuth\DI\HybridAuthExtension

hybridAuth:
    base_url: https://myapp.com/auth/process
    providers:
        Google:
            enabled: true
            keys:
                id: [your-google-key]
                secret: [your-google-secret]
        Facebook:
            enabled: true
            keys:
                id: [your-facebook-key]
                secret: [your-facebook-secret]
            scope: email

Implementation

Then the implementation of /auth controller could look like this:, (*5)

class AuthPresenter extends BasePresenter
{
    /** @var \Gutter\HybridAuth\Manager @inject */
    public $hybridAuth;

    /** @var AuthModel @inject */
    public $model;

    public function actionProcess()
    {
        $this->hybridAuth->process();
    }

    public function actionGoogle()
    {
        $adapter = $this->hybridAuth->authenticate('Google');
        $userProfile = $adapter->getUserProfile();

        $user = $this->model->getUserByEmail($userProfile->email);
        if ($user) {
            $this->login($user);
        }

        $this->redirect('Login:failed');
    }

    public function actionFacebook()
    {
        $adapter = $this->hybridAuth->authenticate('Facebook');
        $userProfile = $adapter->getUserProfile();

        $user = $this->model->getUserByEmail($userProfile->email);
        if ($user) {
            $this->login($user);
        }

        $this->redirect('Login:failed');
    }
}

The Versions

08/08 2016

dev-master

9999999-dev

hybridauth/hybridauth integration into Nette Framework

  Sources   Download

The Requires

 

by David Kaštánek

authentication nette hybridauth

08/08 2016

v1.0.1

1.0.1.0

hybridauth/hybridauth integration into Nette Framework

  Sources   Download

The Requires

 

by David Kaštánek

authentication nette hybridauth

26/04 2016

v1.0

1.0.0.0

hybridauth/hybridauth integration into Nette Framework

  Sources   Download

The Requires

 

by David Kaštánek

authentication nette hybridauth