Game Developer ShawnCZek Posted March 8, 2020 Game Developer Share Posted March 8, 2020 As the official package Laravel Socialite does not accept new adapters and Extended Socialite Providers maintained by the community does not have an active development anymore and its usage is not straight forward like in the first case, we have decided to create an own package that adds a Socialite adapter for Steam OpenID. You can find the source code on GitHub and view the package on Packagist. Installation For installation instructions, head over to the Installation part of README. Documentation As the package uses Laravel Socialite, the usage of the package is exactly same as with different adapters (drivers). Thus, consult the official Laravel documentation. Example Below is an example of a Laravel controller inspired by the official documentation. <?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Lang; use Laravel\Socialite\Facades\Socialite; use Laravel\Socialite\Two\InvalidStateException; class LoginController extends Controller { /** * Redirect the user to the Steam authentication page. * * @return \Illuminate\Http\Response */ public function redirectToProvider() { return Socialite::driver('steam')->redirect(); } /** * Obtain the user information from Steam. * * @return \Illuminate\Http\Response */ public function handleProviderCallback() { try { $user = Socialite::driver('steam')->user(); // $username = $user->getNickname(); } catch (InvalidStateException $exception) { return redirect()->route('login')->with('error', Lang::get('auth.steam.error')); } } } Contribution Any improvements or security vulnerabilities reports are welcome. 5 Game Developer Discord Bot Developer Link to comment Share on other sites More sharing options...
Caernage Posted March 8, 2020 Share Posted March 8, 2020 Thanks for this information, will take a look about implementing it to my project Link to comment Share on other sites More sharing options...
Alon_TMP Posted March 9, 2020 Share Posted March 9, 2020 Wow .nice Link to comment Share on other sites More sharing options...
[ChongQing]*AZhai Posted March 9, 2020 Share Posted March 9, 2020 NIce TruckersMP Profile|Steam|Twitch|YouTube|TruckersMP Forum 中文专区 | 游戏规则| 招募系统 | 举报系统 | 实时地图 Link to comment Share on other sites More sharing options...
Recommended Posts