Package that makes it possible to authenticate against a PHP-Rocker application using google user credentials (

Installs: 2

Dependents: 0

Stars: 0

Watchers: 2

Forks: 1

Open Issues: 0

1.0.3 2013-06-11 17:43 UTC


Install this package in your Rocker application and your users will be able to authenticate with their user credentials at Google.

This installation walk through takes for granted that you have some prior knowledge about composer

1) Install PHP-Rocker

Here you can read more about how to get started with PHP-Rocker

2) Add the Google login package

Add "rocker/google-login" : "1.0.*" to the application requirements in composer.json and call composer update in the console.

3) Edit config.php

In the file config.php you change the authentication class to Rocker\GoogleLogin\Authenticator.

return array(

    'application.auth' => array(
        'class' => '\\Rocker\\GoogleLogin\\Authenticator',
        'mechanism' => 'google realm=""'

4) Implementation

That's it! Now the user can authenticate with e-mail and password registered att Google. The user will be created if he doesn't exist in the database when authenticated.

$ curl -H 'Authorization: google'

    "id" : 10341,
    "email" : "",
    "nick" : "Shawn 1980",
    "meta" : {
        "created" : 1368864490

Tip! Use persistent caching (APC or file based caching) in PHP-Rocker to speed up the server response when requesting operations that requires authentication

Optional configuration

You can add the following configuration to config.php if you want to restrict which authentication mechanisms that should be enabled or which e-mail domains that should be allowed.

'google.login' => array(

    # Comma separated string telling PHP-Rocker that the user has to have an e-mail address
    # at one of the declared domains
    'allowed_domains' => ',',

    # Comma separated string with authentication mechanism that should be disabled
    'disabled_auth_mechanisms' => 'basic,rc4',

    # Whether or not the user credentials should be base64_decoded by the Authentication 
    # class. This option should be set to true in case your'e using rocker.js to 
    # communicate with your Rocker server
    'base64_encoded' => true