2017 © Pedro Peláez
 

library lumen-auth-via-steam

Lumen Steam Auth

image

lightair/lumen-auth-via-steam

Lumen Steam Auth

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 51 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Steam authentication for lumen 7.0.*

This package is a Lumen 7.0.* service provider which provides support for Steam OpenID and is very easy to integrate with any project that requires Steam authentication., (*1)

Installation Via Composer

Add this to your composer.json file, in the require object:, (*2)

"lightair/lumen-auth-via-steam": "v7.0.*"

For v5.4 please use package v5.4.1, (*3)

After that, run composer install to install the package., (*4)

In file bootstrap/app.php uncomment $app->withFacades() and add:, (*5)

$app->register(LightAir\LumenAuthViaSteam\SteamServiceProvider::class);

Lastly, publish the config file., (*6)

php artisan vendor:publish

Usage example

In config/steam-auth.php, (*7)

return [

    /*
     * Redirect URL after login
     */
    'redirect_url' => '/login',
    /*
     *  API Key (http://steamcommunity.com/dev/apikey)
     */
    'api_key' => 'Your API Key',
    /*
     * Is using https?
     */
    'https' => false
];

In routes/web.php, (*8)

$router->get('/login',  'AuthController@login');

In AuthController, (*9)

namespace App\Http\Controllers;

use LightAir\LumenAuthViaSteam\SteamAuth;
use App\User;
use Auth;

class AuthController extends Controller
{
    /**
     * @var SteamAuth
     */
    private $steam;

    public function __construct(SteamAuth $steam)
    {
        $this->steam = $steam;
    }

    public function login()
    {
        if ($this->steam->validate()) {
            $info = $this->steam->getUserInfo();
            if (!is_null($info)) {
                $user = User::where('steamid', $info->steamID64)->first();
                if (is_null($user)) {
                    $user = User::create([
                        'username' => $info->personaname,
                        'avatar'   => $info->avatarfull,
                        'steamid'  => $info->steamID64
                    ]);
                }
                Auth::login($user, true);
                return redirect('/'); // redirect to site
            }
        }
        return $this->steam->redirect(); // redirect to Steam login page
    }
}

The Versions

13/04 2017

dev-master

9999999-dev

Lumen Steam Auth

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikita Brytkov

lumen auth steam

13/04 2017

v5.4.0

5.4.0.0

Lumen Steam Auth

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nikita Brytkov

lumen auth steam