Authentication attempt method not work, when using custom guard
Auth::guard('api')->attempt($credentials)
will get error
Method attempt does not exist
Yes attempt() doesn't work with token guards, only Guards that implement StatefulGuard
Can you provide some more info on this? There doesn't appear to be any documentation. I thought token and passport drivers were completely different. If we want to perform manual authentication, as described in the authentication documentation, but with passport, how are we supposed to do it?
Thank you,
So what to do? Is there anyway to attempt user, without creating LoginProxy, and finding user manually??
+1
any one?? no solution? where is the so called big laravel community?
where is the so called big laravel community?
Not everyone doing what the poster attempting to do. api guard was design to just verify api_key and api_token. There's no concept of attempting to login for this guard.
You might want to consider OAuth2 (check Laravel Passport) or JWT which you need to login using user credential to get an access token.
Not everyone doing what the poster attempting to do
yeah, sure, so that people above is who?
Answer to people :
You need to authorize user manually. Override authorize function so that would find the user by token and then authorize user with Auth::setUser($token->user); etc. That was our workaround with oauth2 authorization. Also u need to override register and all auth functions as well. It's pity that such great framework and such popular package as passport have no connection "out of box" in this case...
It's best to use the community channels if you want help from the community. This repo is for bug reporting and pull requests.
Laracasts Forum
Larachat Slack
Laravel.IO
There's also a Laravel gitter channel
All of these links will take you to a very active community of Laravel developers.
Most helpful comment
Can you provide some more info on this? There doesn't appear to be any documentation. I thought token and passport drivers were completely different. If we want to perform manual authentication, as described in the authentication documentation, but with passport, how are we supposed to do it?
Thank you,