Git Product home page Git Product logo

auth's Introduction

SocialConnect Auth

Packagist License Scrutinizer Code Quality Build Status Dependency Status Scrutinizer Code Coverage HHVM Tested

Open source social sign on PHP. Connect your application(s) with social network(s).

See example.

If I didn't see your issue, PR please ping me direct by Telegram!

Supported type of providers

Supported providers

OpenId

  • PayPal (WIP!)
  • Steam

OAuth 1

  • Twitter
  • 500px
  • Tumblr

OAuth 2

  • Amazon
  • Facebook
  • Vk (ВКонтакте)
  • Instagram
  • Google
  • GitHub
  • GitLab
  • Slack
  • BitBucket
  • Twitch
  • Vimeo
  • DigitalOcean
  • Yandex
  • MailRu
  • Odnoklassniki

OpenIDConnect

  • Google (you can use Google from OAuth2 or OpenIDConnect)

Installation

The recommended way to install socialconnect/auth is via Composer.

  1. If you do not have composer installed, download the composer.phar executable or use the installer.
$ curl -sS https://getcomposer.org/installer | php
  1. Run php composer.phar require socialconnect/auth or add a new requirement in your composer.json.
{
  "require": {
    "socialconnect/auth": "~1.0.0"
  }
}
  1. Run php composer.phar update

How to use

Composer:

composer install 

First you need to setup SocialConnect\Auth\Service:

$configuration = [
        'redirectUri' => 'http://sconnect.local/auth/cb',
        'provider' => [
            'facebook' => [
                'applicationId' => '',
                'applicationSecret' => '',
                'scope' => [
                    'email'
                ]
            ],
        ]
];

$service = new \SocialConnect\Auth\Service(
    new \SocialConnect\Common\Http\Client\Curl(),
    new \SocialConnect\Provider\Session\Session(),
    $configuration
);

Next create you loginAction:

$providerName = 'facebook';

$provider = $service->getProvider($providerName);
header('Location: ' . $provider->makeAuthUrl());

And implement callback handler:

$providerName = 'facebook';

$provider = $service->getProvider($providerName);
$accessToken = $provider->getAccessTokenByRequestParameters($_GET);
var_dump($accessToken);

$user = $provider->getIdentity($accessToken);
var_dump($user);

License

This project is open-sourced software licensed under the MIT License.

See the LICENSE file for more information.

auth's People

Contributors

davo81 avatar layershifter avatar ovr avatar s0lus avatar scrutinizer-auto-fixer avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.