Skip to content

2.x Usage Lumen

Sam edited this page Apr 27, 2019 · 2 revisions
  1. Create the Controller.
    • This example Controller will be placed in the app/Http/Controllers/Auth/ folder.
<?php

namespace App\Http\Controllers\Auth;

use Illuminate\Http\Request;
use kanalumaddela\LaravelSteamLogin\Http\Controllers\AbstractSteamLoginController;
use kanalumaddela\LaravelSteamLogin\SteamUser;

class SteamLoginController extends AbstractSteamLoginController
{
    /**
     * Return the player's details in json for example purposes.
     * 
     * @param \Illuminate\Http\Request                   $request
     * @param \kanalumaddela\LaravelSteamLogin\SteamUser $steamUser
     *
     * @return \Illuminate\Http\JsonResponse
     */
    public function authenticated(Request $request, SteamUser $steamUser)
    {
        $steamUser->getUserInfo();

        return \response()->json($steamUser->toArray(), 200, [], JSON_PRETTY_PRINT);
    }
}
  1. Add the routes to your routes/web.php
$router->get('login/steam', ['uses' => 'Auth\SteamLoginController@login', 'as' => 'login.steam']);
$router->get('auth/steam', ['uses' => 'Auth\SteamLoginController@authenticate', 'as' => 'auth.steam']);
Clone this wiki locally