Support the ongoing development of Laravel.io →
posted 7 years ago
Last updated 2 years ago.
0

Hello guys, hope you all doing great :)

I have a problem for a wake and tried a lot to solve it

Passport error -> {error: "Unauthenticated."} undefined undefined 401 I searched a lot and tried different things, and the thing is making me so mad that it's working so good in my localhost when I upload it in the real server I got this message and I being trying for a wake now to solve it, any help, please :(

0

jake, You will need to show some code. Either something is wrong in the login process or you are displaying the wrong user record in your view.

0

Thanks for the reply @snapey,

I don't know which code I'm going to show. It seems login process is working. I removed the remember token to user table but still problem exist.

I try to check the user through this:

{{ Auth::user()->firstname}}

Btw, where can I find the login process?

I followed this video Multiple Authentication Series

LoginController


{
    
    use AuthenticatesUsers;

    /**
     * Where to redirect users after login.
     *
     * @var string
     */
    protected $redirectTo = '/home';

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct()
    {
        $this->middleware('guest', ['except' => ['logout', 'userLogout']]);
    }

    public function userLogout()
    {
        Auth::guard('web')->logout();
        return redirect('/');
    }
}

User Login Form


<form class="form-horizontal" role="form" method="POST" action="{{ route('login') }}">
                        {{ csrf_field() }}

                        <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                            <label for="email" class="col-md-4 control-label">E-Mail Address</label>

                            <div class="col-md-6">
                                <input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>

                                @if ($errors->has('email'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                            <label for="password" class="col-md-4 control-label">Password</label>

                            <div class="col-md-6">
                                <input id="password" type="password" class="form-control" name="password" required>

                                @if ($errors->has('password'))
                                    <span class="help-block">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-md-8 col-md-offset-4">
                                <button type="submit" class="btn btn-primary">
                                    Login
                                </button>

                                <a class="btn btn-link" href="{{ route('password.request') }}">
                                    Forgot Your Password?
                                </a>
                            </div>
                        </div>
                    </form>

User Model



    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        't_id','firstname','middlename','lastname','email','password'
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 'remember_token',
    ];

    protected $primaryKey = 't_id';
}

Thanks,

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Jake Quims Jake Quims frixk Joined 15 Jul 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.