codecasts / laravel-jwt

Dead simple, plug and play JWT API Authentication for Laravel (5.4+)
MIT License
234 stars 27 forks source link

Typo in readme.md? #35

Open salkz opened 6 years ago

salkz commented 6 years ago

Token from User Credentials.

This method should be used when you just registered a user and any other special cases.

I think this should be "This method should be used when you want to authenticate a user and any other special cases." because the function

public function tokenFromCredentials(Guard $auth, Request $request)
{
    // get some credentials
    $credentials = $request->only(['email', 'password']);

    if ($auth->attempt($credentials)) {
       return $token = $auth->issue();
    }

    return ['Invalid Credentials'];
}

really looks like the one in https://laravel.com/docs/5.6/authentication#authenticating-users section.

public function authenticate(Request $request)
{
    $credentials = $request->only('email', 'password');

    if (Auth::attempt($credentials)) {
        // Authentication passed...
        return redirect()->intended('dashboard');
    }
}
hernandev commented 6 years ago

Correct.

if you notice, the two sections have the same explanation, meaning I've just copied it over and forgot to change.

Lazy me.

Wanna PR a fix? If not, I'll update that later today.

Thanks for the feedback, I don't have the habit of reading after, should do it more often.

Thank you!