I read this thread Laravel basic-auth but he found out there's a type because of User model but I checked mine and I'm using the default User model from laravel and getting the same problem. I actually tried locally and it worked perfectly but after I uploaded to the server it just kept on asking me for username/password.
I have this in my routes
Route::get('/', function()
{
$user = User::create(array(
'username' => 'test@test.test',
'password' => Hash::make('test')
));
$user->save();
return View::make('hello');
});
Route::group(array('before' => 'auth.basic'), function(){
Route::resource('posts', 'PostsController');
});
I tried this way to go into public to create the fields in my database. After created I went to /public/posts and it asked kept on telling me to sign in. Again I tried this way locally and worked perfectly.
anyone has any idea?
The documentation states that by default the basic authentication will use the email
column on the user record when authenticating, but you have a username
column instead.
Basically, you need to tell the filter, that you want to use that column in filters.php:
Route::filter('auth.basic', function()
{
return Auth::basic('username');
});