PHPackages                             ipunkt/social-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. ipunkt/social-auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

ipunkt/social-auth
==================

Wrapper which allows login through oauth-esque providers by only setting their configuration values

1.0rc1(11y ago)11861MITPHPPHP &gt;=5.4.0

Since Oct 23Pushed 11y ago5 watchersCompare

[ Source](https://github.com/ipunkt/social-auth)[ Packagist](https://packagist.org/packages/ipunkt/social-auth)[ Docs](https://github.com/ipunkt/social-auth)[ RSS](/packages/ipunkt-social-auth/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

ipunkt/social-auth
==================

[](#ipunktsocial-auth)

Social-Auth is a Laravel package which wraps around a oauth library and laravel with the goal to let you simply set the provider credentials and be done.

It currently uses hybrid\_auth in the background. With the coming of the new SocialLite package for laravel i will probably switch out hybrid\_auth for it.

Install
=======

[](#install)

Installation
------------

[](#installation)

Add the following lines to your composer.json:

```
"require": {
    "ipunkt/social-auth": "dev-master"
}

```

Configuration
-------------

[](#configuration)

To configure 3 steps are necessary.
If you wish for user deletes to trigger deletion of their mappings to provider accounts make sure to set the 'user table' variable in the config before migrating

### Add the service provider

[](#add-the-service-provider)

Add

```
'Ipunkt\SocialAuth\SocialAuthServiceProvider'

```

to your app.php

### Publish and set your config

[](#publish-and-set-your-config)

Publish

```
php artisan config:publish ipunkt/social-auth

```

then set your provider credentials in

```
app/config/packages/ipunkt/social-auth/config.php

```

### Migrate

[](#migrate)

Migrate the necessary database tables.

```
php artisan migrate --package="ipunkt/social-auth"

```

Use
---

[](#use)

### Error and Message Handling

[](#error-and-message-handling)

This package tries not to bring any views of its own, thus error handling is done through the session. On success, 'message' will be set directly in the Session. e.g. `{{ Session::get('message') }}`On error, 'message' will be set in errors. e.g. {{ $errors-&gt;first('message') }}

### Authenticating with SocialAuth

[](#authenticating-with-socialauth)

#### Login

[](#login)

Letting your users log in through a SocialAuth provider is as simple as directing them to the `social.login` route with the name of the provider as parameter.

```
{{ link_to_route('social.login', 'log in through Facebook',  'Facebook' }}
```

#### Attaching a Provider

[](#attaching-a-provider)

#### Registering

[](#registering)

Allowing your users to register using a provider account requires a little more work.

- First, make sure the 'register route' variable is set correctly in your config file.
- Provide the user a link to the `social.register` route, with the provider name as its parameter. e.g. `{{ link_to_route('social.register', 'register through Facebook', ['Facebook']) }}`
- If the user successfully logs into the provider they will be redirected back to your registration process. There you can access their account data through SocialAuth::getRegistration()
- If the registration process finishes successfuly, call SocialAuth::getRegistration()-&gt;success($newlyCreatedUser) to create the connection between the local and provider account.

#### Links to all enabled Providers

[](#links-to-all-enabled-providers)

Most of the time you will want to provide links to all enabled providers instead of a certain one.
To do this, use `SocialAuth::getProviders()` to grab all enabled providers and use \*Link($innerHtml) to have it build a link for you.

- ProviderInterface::loginLink($innerHtml)
- ProviderInterface::attachLink($innerHtml)
- ProviderInterface::registerLink($innerHtml)

Example:

```
@foreach(SocialAuth::getProviders() as $provider)
    if(Auth::check()) {
        // A link which lets you attach a user from this provider to your local account
        {{ $provider->attachLink($provider->getName()) }}
    } else {
        // A link which lets you login through this provider
        {{ $provider->loginLink($provider->getName()) }}

        // A link which lets a user request a running registration to use an account on this provider to login
        {{ $provider->registerLink($provider->getName()) }}
    }
@endforeach
```

#### Profile

[](#profile)

The Profile is currently dependant on Hybrid\_Auth\_Profile as the underlying package

ProfileInterface

Functionreturned valuegetIdentifierThe unique identifier string by which the provider identifies the usergetProfileUrlProfile URLgetWebsiteUrlWebsite URLgetPhotoUrlPhoto URLgetDisplayNameDisplay name or "$firstName $lastName"getDescriptiongetFirstNameFirst namegetLastNameLast namegetGenderGendergetLanguageLanguagegetAgeAgegetBirthDayDay of BirthgetBirthMonthMonth of BirthgetBirthYearYear of BirthgetEmailEmailgetVerifiedEmailVerified Email if the provider allows itgetPhonePhone numbergetAddressAddressgetCountryCountrygetRegionRegiongetCityCitygetZipZIP or Postal codeThere are 3 Ways to access Profiles:

- Through the providers
    `SocialAuth::getProviders()['Facebook']->getProfile()`
    This will give you the currently logged in Users Profile on the given Provider. If the User is not currently logged in through this Provider then the values stored in the Database will be returned.
- Through `SocialAuth::getProfile`This will give you the Profile of the currently logged in User with the special 'UserProfile' Provider. It contains the same data as the first Provider Profile to be registered or attached to this user.
- Through the UserModel implementing HasProfileInterface implementing HasProfileInterface will allow you to manage profiles not just for the active user but all users in your database. A default implementation using Eloquent is available through the `EloquentHasProfile` trait

### Return Url

[](#return-url)

Your provider will ask you to set a return url where user logging into your application get sent. This is static:

Advanced Use
------------

[](#advanced-use)

### Use your own ORM

[](#use-your-own-orm)

To switch out Eloquent for the ORM of your choice do the following

1.

Create a model which implements the SocialLoginInterface Create a repository which implements the SocialLoginrepository interface

bind this repository to 'Ipunkt\\SocialAuth\\SocialLoginInterface' in the Laravel IoC

2.

Create a repository which implements the UserRepository interface

bind this repository to 'Ipunkt\\SocialAuth\\Repositories\\UserRepository' in the Laravel IoC

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Total

2

Last Release

4201d ago

Major Versions

0.1.0 → 1.0rc12014-11-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f1ab6ff16fc96d20efd363563c961db68587721536c6559d692f461588a1246?d=identicon)[svensp](/maintainers/svensp)

---

Tags

phplaraveloauth

### Embed Badge

![Health badge](/badges/ipunkt-social-auth/health.svg)

```
[![Health](https://phpackages.com/badges/ipunkt-social-auth/health.svg)](https://phpackages.com/packages/ipunkt-social-auth)
```

###  Alternatives

[artdarek/oauth-4-laravel

OAuth Service Provider for Laravel 4

693504.8k](/packages/artdarek-oauth-4-laravel)[oriceon/oauth-5-laravel

OAuth Service Provider for Laravel 5

1851.5M](/packages/oriceon-oauth-5-laravel)[pingpong/twitter

Twitter OAuth for Laravel

3145.9k](/packages/pingpong-twitter)[kovah/laravel-socialite-oidc

OpenID Connect OAuth2 Provider for Laravel Socialite

2073.7k](/packages/kovah-laravel-socialite-oidc)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
