Skip to content

Instantly share code, notes, and snippets.

@pepzwee
Created May 27, 2016 16:54
Show Gist options
  • Save pepzwee/57bbbb04e11fa6016dcf4d011febf6dc to your computer and use it in GitHub Desktop.
Save pepzwee/57bbbb04e11fa6016dcf4d011febf6dc to your computer and use it in GitHub Desktop.
<?php
Route::post('authenticate', function() {
// This gets userHash and decrypts it to an ID
// try{} catch(xxxException $e) {} - if its not correct format (script kiddies) it will throw an exception of some kind
$user_id = Crypt::decrypt($request->input('userHash'));
// Authenticate
Auth::loginUsingID($user_id);
// redirect anywhere you want
return redirect('/');
});
In this file where you log-in. You need to do these things:
1. Get steamID64 and find the user_id
2. Encrypt the user_id
3. Either make Route::post(authenticate) to a get so you can redirect without problems or you make it to GET and with parameters (less safe)
3.1 http://stackoverflow.com/questions/5576619/php-redirect-with-post-data
3.2 You will also need to think of a way to prevent "hackers"
3.2.1 Maybe csrf_token will help?
3.3 Don't use redirect('authenticate') because then it will use the same domain, instead use redirect('http://correctdomain.com/authenticate')
4. Should work
5. Profit?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment