PHPackages                             betterbrief/silverstripe-opauth - 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. betterbrief/silverstripe-opauth

AbandonedArchivedSilverstripe-module[Authentication &amp; Authorization](/categories/authentication)

betterbrief/silverstripe-opauth
===============================

SilverStripe 3.1 OpAuth module. See: http://opauth.org/

v1.1.2(10y ago)3321.8k21BSDPHP

Since Dec 6Pushed 7y ago3 watchersCompare

[ Source](https://github.com/BetterBrief/silverstripe-opauth)[ Packagist](https://packagist.org/packages/betterbrief/silverstripe-opauth)[ Docs](https://github.com/BetterBrief/silverstripe-opauth)[ RSS](/packages/betterbrief-silverstripe-opauth/feed)WikiDiscussions 1.1 Synced 2mo ago

READMEChangelog (4)Dependencies (3)Versions (7)Used By (0)

**This module depends on Opauth which is no longer maintained - we don't recommend continuing to use this module as we aren't actively developing it any longer.**

SilverStripe Opauth Module
==========================

[](#silverstripe-opauth-module)

[![Build Status](https://camo.githubusercontent.com/da5157bbe7a4465f2fe061e1f62ad18fd6d6500b75f8f45bd33c257581994633/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f42657474657242726965662f73696c7665727374726970652d6f70617574682e706e673f6272616e63683d6d6173746572)](http://travis-ci.org/BetterBrief/silverstripe-opauth)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/6dbf0c257a270618ac3a4ee7455fc4ca6f59beca025d718074215e463f16debe/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f42657474657242726965662f73696c7665727374726970652d6f70617574682f6261646765732f7175616c6974792d73636f72652e706e673f733d32353731313664303432306138363131356164646565343861666663393161386162623431393339)](https://scrutinizer-ci.com/g/BetterBrief/silverstripe-opauth/)[![Code Coverage](https://camo.githubusercontent.com/6ece605b9cdc79607320c014a27d4d3cec159c3af884ea522de6dd5cc74835c6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f42657474657242726965662f73696c7665727374726970652d6f70617574682f6261646765732f636f7665726167652e706e673f733d33636130366437336661396165623264633735313363346361366636636637303361363834393131)](https://scrutinizer-ci.com/g/BetterBrief/silverstripe-opauth/)

Introduction
------------

[](#introduction)

Uses the [Opauth library](http://opauth.org) for easy drop-in strategies for social login. See their [documentation](https://github.com/opauth/opauth/wiki/)

Current Status
--------------

[](#current-status)

1.1 - stable. No known major issues. Report issues using the [bug tracker](https://github.com/BetterBrief/silverstripe-opauth/issues).

How does it work?
-----------------

[](#how-does-it-work)

The module provides an additional login form which the developer has control over, that allows users to instantly sign in to your website with an identity provided by any Oauth provider. The providers are each handled by using an `OpauthStrategy`, many of which are freely available. There are strategies for Facebook, Twitter, Google, and many more.

Based on the identity data from the Oauth provider, the module will find or create a new `Member` object based on the provided email address in the identity. This also means a Member can have many Oauth identities linked to a single account; these are saved in to the `OpauthIdentity` object.

If the resultant `Member` generated from the provider's response doesn't have an email address, or any other piece of data you require, there is functionality built in to handle this. You can enforce required fields, or any other kind of validation, by setting the `OpauthValidator`'s `custom_validator` property to the class name of the validator you require.

Other than that, the user flow is quite simple. Provided all required data is there, the member is logged in with `Member::login` and then redirected to the page they were looking at or the default destination, settable in your config - just like the default `MemberAuthenticator`.

Requirements
------------

[](#requirements)

- SilverStripe 3.1 (maybe 3.0, but untested so far)
- At least one Opauth strategy
- Preferably, allow\_url\_fopen enabled in php.ini. We've written a custom cURL workaround that works with Twitter, Google and Facebook strategies, but it's proprietary.
- For extended cURL support we rely on an Opauth fork

FAQ
---

[](#faq)

### What does this module include?

[](#what-does-this-module-include)

It includes:

- the Opauth core (see below);
- `OpauthAuthenticator`: intended to be comparable with `MemberAuthenticator`;
- `OpauthLoginForm`: which offers different ways you can authenticate;
- `OpauthRegisterForm`: which, if configured, provides an intermediate step so incomplete `OpauthIdentity`-authenticating members can fill in extra information as required;
- `OpauthController`: which acts as a negotiator for the communication that strategies undertake;
- `OpauthIdentity`: which acts as a service-agnostic interface with which to save Oauth identities in to the `Member` object. These are associated with a `Member` upon successful login so that the auth provider's UID and signed response act as a key.

*NB: Opauth's maintainers recommend you include strategies as required, rather than bundling them together.*

### Where can I get strategies?

[](#where-can-i-get-strategies)

You can find a list under the "Available Strategies" heading on the [Opauth homepage](http://opauth.org)

Packagist provides a [list of strategies](https://packagist.org/search/?q=opauth/) you can use to install via Composer.

### Where should I put strategies?

[](#where-should-i-put-strategies)

Use composer to require your strategies

### How do I map the API responses to a `Member`?

[](#how-do-i-map-the-api-responses-to-a-member)

You define the `OpauthIdentity` `member_mapper` block in your `_config.yml`. Simply provide a hash map of member fields to dot notated paths of the Opauth response array for simple fields, or if you need to perform some parsing to retrieve the value you want, an array of class name and function, like `['OpauthResponseHelper', 'get_first_name']`. It takes the auth response array as an argument. See the example config YAML below for more details.

### How do I configure the module and its strategies?

[](#how-do-i-configure-the-module-and-its-strategies)

All Opauth-specific configuration variables can be put under `opauth_settings` and are passed directly to `Opauth`.

You can put these settings in your `_config.yml` file. Additionally, as your strategy API details will likely change per domain and thus per environment, you are able to update these using the `Config` API. Please see the [Opauth config documentation](https://github.com/opauth/opauth/wiki/Opauth-configuration#configuration-array). Here's some examples to help you:

###### `_config.yml` example:

[](#_configyml-example)

```
---
Name: silverstripe-opauth
After: 'framework/*','cms/*'
---
# see the Opauth docs for the config settings - https://github.com/opauth/opauth/wiki/Opauth-configuration#configuration-array
OpauthAuthenticator:
  opauth_settings:
    #Register your strategies here
    #Including any extra config
    Strategy:
      Facebook:
        app_id: ''
        app_secret: ''
        scope: email
      Google:
        client_id: ''
        client_secret: ''
      Twitter:
        key: ''
        secret: ''
    security_salt: 'correct horse battery staple'
    security_iteration: 500
    security_timeout: '2 minutes'
    callback_transport: 'session'
#Configuration for the Identity-Member mapping
OpauthIdentity:
  member_mapper:
    Facebook:
      FirstName: 'info.first_name'
      Surname: 'info.last_name'
      Locale: 'raw.locale'
      Email: 'info.email'
    Twitter:
      FirstName: ['OpauthResponseHelper', 'get_first_name']
      Surname: ['OpauthResponseHelper', 'get_last_name']
      Locale: ['OpauthResponseHelper', 'get_twitter_locale']
    Google:
      FirstName: 'info.first_name'
      Surname: 'info.last_name'
      Email: 'info.email'
      Locale: ['OpauthResponseHelper', 'get_google_locale']
```

##### `_config.php` example:

[](#_configphp-example)

```
//Register and configure strategies
Config::inst()->update('OpauthAuthenticator', 'opauth_settings', array(
  'Strategy' => array(
    'Facebook' => array(
      'app_id' => '',
      'app_secret' => '',
      'scope' => 'email',
    ),
    'Google' => array(
      'client_id' => '',
      'client_secret' => ''
    ),
    'Twitter' => array(
      'key' => '',
      'secret' => ''
    ),
  ),
));

//Identity to member mapping settings per strategy
Config::inst()->update('OpauthIdentity', 'member_mapper', array(
  'Facebook' => array(
    'FirstName' => 'info.first_name',
    'Surname' => 'info.last_name',
    'Locale' => 'raw.locale',
    'Email' => 'info.email',
  ),
  'Twitter' => array(
    'FirstName' => array('OpauthResponseHelper', 'get_first_name'),
    'Surname' => array('OpauthResponseHelper', 'get_last_name'),
    'Locale' => array('OpauthResponseHelper', 'get_twitter_locale'),
  ),
  'Google' => array(
    'FirstName' => 'info.first_name',
    'Surname' => 'info.last_name',
    'Email' => 'info.email',
    'Locale' => array('OpauthResponseHelper', 'get_google_locale'),
  ),
));
```

*NB: As you can see, sometimes the Strategy configuration settings may have inconsistent namings - we can't help with that, sorry!*

Documentation
-------------

[](#documentation)

Please read the [Opauth documentation](https://github.com/opauth/opauth/wiki/) and [our own documentation](docs/en/)

Raising bugs and suggesting enhancements
----------------------------------------

[](#raising-bugs-and-suggesting-enhancements)

If you find a bug or have a Really Good Idea™, please [raise an issue](https://github.com/BetterBrief/silverstripe-opauth/issues). Better still, if you can fix the bug, then feel free to send in a pull request with the remedial code that ideally respects the coding conventions used thus far.

Attribution
-----------

[](#attribution)

- Opauth available under MIT licence by U-Zyn Chua () Copyright © 2012-2013

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~190 days

Recently: every ~238 days

Total

6

Last Release

3588d ago

Major Versions

v1.1.2 → v2.0.0-alpha.12015-12-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3c3dd059004c448ed6bce3c1b96c63ee469314a43672467198fe95a087c51ba?d=identicon)[betterbrief](/maintainers/betterbrief)

---

Top Contributors

[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (28 commits)")[![willmorgan](https://avatars.githubusercontent.com/u/168688?v=4)](https://github.com/willmorgan "willmorgan (14 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (12 commits)")[![johannesx75](https://avatars.githubusercontent.com/u/3908339?v=4)](https://github.com/johannesx75 "johannesx75 (3 commits)")

---

Tags

silverstripeoauthloginsocialOPAuth

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/betterbrief-silverstripe-opauth/health.svg)

```
[![Health](https://phpackages.com/badges/betterbrief-silverstripe-opauth/health.svg)](https://phpackages.com/packages/betterbrief-silverstripe-opauth)
```

###  Alternatives

[overtrue/socialite

A collection of OAuth 2 packages.

1.4k5.5M87](/packages/overtrue-socialite)[bigfork/silverstripe-oauth-login

SilverStripe logins via OAuth2, using the PHP League's OAuth2 client

1794.7k2](/packages/bigfork-silverstripe-oauth-login)[mmanos/laravel-social

A social login package for Laravel 4.

556.8k](/packages/mmanos-laravel-social)

PHPackages © 2026

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