Created
May 27, 2016 16:54
-
-
Save pepzwee/57bbbb04e11fa6016dcf4d011febf6dc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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('/'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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