-
Notifications
You must be signed in to change notification settings - Fork 10
1.x Configuration
Sam edited this page Apr 14, 2018
·
2 revisions
- Set all the variables in your
.env
file. These lib is made to work if you don't set anything. The config files are published toconfig/steam-login.php
. The config is pasted below.
<?php
return [
/*
* Login route
*/
'login_route' => env('STEAM_LOGIN', '/login'),
/*
* Return route
*/
'return_route' => env('STEAM_RETURN', '/auth/steam'),
/*
* Timeout when validating
*/
'timeout' => env('STEAM_TIMEOUT', 5),
/*
* Method of retrieving user's info
*/
'method' => env('STEAM_PROFILE_METHOD', 'xml'),
/*
* API key (http://steamcommunity.com/dev/apikey)
*/
'api_key' => env('STEAM_API_KEY', ''),
];
- Add the routes in
routes/web.php
Route::get('logout', 'Auth\LoginController@logout')->name('logout'); // or use the default post method if you prefer
Route::get('login/steam', 'Auth\SteamLoginController@login')->name('login.steam');
Route::get('auth/steam', 'Auth\SteamLoginController@handle')->name('auth.steam');
- Share the login url and steam button images (if you choose) across blade templates in
app/Providers/AppServiceProvider.php
. This allows you to create your own login button style or use the built in steam login buttons.- Import the
Illuminate\Support\Facades\View
to share the variables andkanalumaddela\LaravelSteamLogin\SteamLogin
namespace to inject an instance ofSteamLogin
- Import the
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\View; // <-- add this
use kanalumaddela\LaravelSteamLogin\SteamLogin; // <-- add this
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot(SteamLogin $steam) // boot() --> boot(SteamLogin $steam)
{
View::share('steam_login', $steam->loginUrl());
View::share('steam_button_small', SteamLogin::button('small'));
View::share('steam_button_large', SteamLogin::button('large'));
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
}