Category : authentication

So I am currently playing around with Laravel and tailwind. I have created a project and working through some initial views. Next todo was to add auth scaffolding to the project. Tried googling around, found https://aregsar.com/blog/2020/create-laravel-project-with-tailwind-ui-and-auth/. I also checked a couple of other results which had the same pointers. So run composer require laravel-frontend-presets/tailwindcss –dev, ..

Read more

So I am currently playing around with Laravel and tailwind. I have created a project and working through some initial views. The next to do was to add auth scaffolding to the project. I tried googling around, found https://aregsar.com/blog/2020/create-laravel-project-with-tailwind-ui-and-auth/. I also checked a couple of other results which had the same pointers. So run composer ..

Read more

i want to login with gmail, i create laravel authentication, i add button login with google, i install laravel socialite package by command composer require laravel/socialite, i add configuration in config/services: ‘google’ => [ ‘client_id’ => env(‘GOOGLE_CLIENT_ID’), ‘client_secret’ => env(‘GOOGLE_CLIENT_SECRET’), ‘redirect’ => ‘http://localhost:8000/laravel-socialite/public/login/google/callback’, ], I added in routes/web.php the routes: Route::get (‘login/google’,[AppHttpControllersAuthLoginController::class, ‘redirectToGoogle’])->name(‘login.google’); Route::get(‘login/google/callback’,[AppHttpControllersAuthLoginController::class,’handleGoogleCallback’]); I ..

Read more

I have a Laravel8 Project where I am doing everything from scratch so i can learn the system (newbie) – I have a LoginController with the code namespace AppHttpControllersAuth; use AppHttpControllersController; use IlluminateHttpRequest; class LoginController extends Controller { /** * Display a listing of the resource. * * @return IlluminateHttpResponse */ public function index() { ..

Read more

I’m working on a Laravel project that only requires login (No registration), The Laravel uses an existing user tables (with all user data) which have the password stored with MD5 hashing. when i tried the login using the code below it returns false Auth::attempt([‘Email’ => $request->get(‘Email’), ‘Password’ =>md5($password)]) Is there any way to use only ..

Read more

I’m using auth Sanctum and I can’t log out of my account. I don’t understand why. //controller public function logout(Request $request){ Auth::logout(); $request->session()->invalidate(); $request->session()->regenerateToken(); session() -> pull(‘user’); $user = request()->user(); //or Auth::user() $user->tokens()->where(‘id’, $user->currentAccessToken()->id)->delete(); return view(‘admin.login.index’); } //view <form method="post" action=" {{ route(‘logout’) }} "> @csrf <button type="submit"> logout </button> </form> Sourc..

Read more

I’m using Laravel 8. I have folder that references ckfinder in /public/plugins/ckfinder directory. CheckAuthentication function in config.php , When adding images, error occurs $config[‘authentication’] = function () { require $_SERVER[‘DOCUMENT_ROOT’] . ‘/vendor/autoload.php’; $app = require_once $_SERVER[‘DOCUMENT_ROOT’]. ‘/bootstrap/app.php’; $response = $app->make(‘IlluminateContractsHttpKernel’)->handle(IlluminateHttpRequest::capture()); $cookie = $_COOKIE[$app[‘config’][‘session’][‘cookie’]] ?? false; if ($cookie) { $id = $app[‘encrypter’]->decrypt($cookie, false); $session = $app[‘session’]->driver(); ..

Read more

In my API after the user registers, a token is created with this code : $token = JWTAuth::fromUser($user); when i use dd($token) , returns this : eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC8xMjcuMC4wLjE6ODAwMFwvYXBpXC9sb2dpbiIsImlhdCI6MTYyNjgxNDM2NCwiZXhwIjoxNjI2ODE3OTY0LCJuYmYiOjE2MjY4MTQzNjQsImp0aSI6Imd3eDZnVzNGTGN4MzlMekIiLCJzdWIiOjQsInBydiI6IjIzYmQ1Yzg5NDlmNjAwYWRiMzllNzAxYzQwMDg3MmRiN2E1OTc2ZjcifQ._m-7tojFaupUbAibDUbLJm6BeuFVL_etdFlwj0h5664 so how can i find the id of user without entering this token in authorization of postman ? Sourc..

Read more

This is the unit test which I want to run. This is always failing. I have tried with wrong data. Still it fails and with correct data still it fails. Please someone help me out from this. If anyone wants to explore more: http://github.com/PawanRoy1997/forum.git Php Unit Test: <?php namespace TestsFeature; use AppModelsUser; use IlluminateFoundationTestingRefreshDatabase; use ..

Read more

Does anybody know how to customize ResetPassword logic in Laravel. I want to use custom field ‘phone’ vs ’email’. Small workaround with create_passwords_resets migration and done public function up() { Schema::create(‘password_resets’, function (Blueprint $table) { $table->string(‘phone’)->index(); $table->string(‘token’); $table->timestamp(‘created_at’)->nullable(); }); } But i’ve started to get exceptions on absent field ’email’ users tables simply doesn’t have ..

Read more

Hello I am new to laravel i was trying to make authenticate user using auth but the auth::attempt method always returns false Below is my code Model namespace AppModels; use IlluminateDatabaseEloquentFactoriesHasFactory; use IlluminateDatabaseEloquentModel; use AppHttpControllersstudentController; use IlluminateFoundationAuthUser as Authenticatable; class student extends Authenticatable { use HasFactory; protected $guard=’student’; protected $fillable = [ ‘name’, ‘password’, ‘fee’, ..

Read more

I am trying to add Facebook authentication but when the response returns it shows a null email and name. I need an email to register the user to perform some activities. public function socialLoginfb() { // return Socialite::driver(‘facebook’)->redirect(); return Socialite::driver(‘facebook’)->fields([ ‘first_name’, ‘last_name’, ’email’, ‘gender’, ‘birthday’ ])->scopes([ ’email’, ‘user_birthday’ ])->redirect(); } public function handleProviderFacebookCallback(Request $request) { ..

Read more

I have following code on logout method: logout() { let token = localStorage.getItem(‘token’); let response = axios.post(‘/auth/logout’,{ headers: { ‘Authorization’: "Bearer "+token, ‘Content-Type’: ‘application/json’ } }); if (response.status == 200) { window.localStorage.removeItem(‘access_token’); delete axios.defaults.headers.common[‘Authorization’]; this.$router.replace(‘/login’) } else { this.$router.push(‘/’) } } And in my controller I have public function logout() { $this->guard()->logout(); return api_response(null, false, ..

Read more

I want to use laravel fortify for a table other than the user table. For example, the school management system that the student enters his panel using his security information in the student table and not the user table.please guide me! Sourc..

Read more