auth.reminder.repository for Laravel 5.8 - laravel

I have the following lines of code
// Creates new password reminder token and deletes old one.
$token = app('auth.reminder.repository')->create($user);
The $token is then used to send an email and allow users to change their password.
In Laravel 5.8 the auth.reminder.repository does not exists.
In Laravel 4.x in was aliased to Auth\Reminders\ReminderServiceProvider
Need help figuring out how to update the code for Laravel 5.8.

$password_broker = app(\Illuminate\Auth\Passwords\PasswordBroker::class);
// Create reset password token.
$token = $password_broker->createToken($user);

Related

Laravel 5.5.* Cookie::get return encrypted cookie value

I try
Cookie::queue(Cookie::forever('test', 'TEST'));
$value = Cookie::get('test');
and get like this eyJpdiI6ImNzUFNON0N0c1UzRUlWMTVFQ01rMnc9PSIsInZhbHVlIjoiU2JadHRhRFRcL3RES2VNT1dPOE84YTR0d0NQTnhiUEs3bllcL3ZiczYzaFhxc2h0NGR0MzllNmtJcDRqZnMza2NCK1FlZ...
Laravel should automatically encrypt or not?
Cookies in laravel are automatically encrypted

Laravel/lumen tymon/jwt-auth get data from JWT token providing first user record

$token = $this->jwt->getToken();
$this->jwt->user();
$data = $this->jwt->setToken($token)->toUser();
I am trying to get the user detail based on token in laravel/Lumen but its always return the first user details. I already cross check the login detail which is fine.

Laravel passport Authorization token expire on generating new token

I am using laravel 5.5 with passport authentication for API Routes. I am using bearer token.
The problem is that the old generated token is accepted in place of unauthenticated.
Steps :
create one bearer token. Use it. It is working fine.
create another token without logout and it is working fine.
now if I use the first created token it is also working. It should not be working but it is accepted.
Is there any way by what I can achieve this?
Thanks in advance.
One possible solution is:
Check before creating a new token, if an old one is existing and delete this one. To do this:
Create a Model named OauthAccessToken
Update your User Model the following
/**
* 1:n zu access token, we need to logout users
*
* #return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function accessTokens()
{
return $this->hasMany(OauthAccessToken::class);
}
Now you can check with this and delete all tokens from a user
if ($user->accessTokens->count() > 0) {
$user->accessTokens()->delete();
}

Login Authenticate issue in Laravel 5.4

I am trying to making a login system where i manually inserted "Email" and "Password" in Database .Because there are no Register System.
Now my password not hashes/encrypted in my Database.When we will attempt to login Laravel will try to Authenticate user by hashes/encrypted Password.How Solve this issue.Can anybody help me??
Use Laravel tinker
ssh into your server. Then:
php artisan tinker
Find your user:
$user = User::find(1);
Set the password/email
$user->password = bcrypt('yourpassword');
$user->email = 'info#corporation.com';
Save it
$user->save();
Done.

Laravel get user info by Jwt token

I'm using laravel as my backend.
Once the user has logged into my app, all I have is just a token without any information regards the username or any other user details.
Once I retrive the JWT Token and store it in my frontend (angular2), how I can get the user details?
For the record, i'm using the following laravel library:
https://github.com/tymondesigns/jwt-auth
To get the user information
First get the token from JWTAuth like this:
$token = JWTAuth::getToken();
Then get the user from the token as follows:
$user = JWTAuth::toUser($token);
you can get user information like this way :
$user = JWTAuth::toUser(your_token_here);
I have tested just
$user = JWTAuth::toUser();
Without any parameter and it works as well
I am using Laravel 7.3 with tymon/jwt-auth 1.0
JWTAuth::parseToken()->authenticate();

Resources