Closed radmen closed 6 years ago
Ideally there should never be a login
method in JWT, since login means, you have a stateful loggedin state, which is not true with JWT
.
So it's fine to throw the exception and set right expectations
I took more detailed peek at the docs and found information about why there's a difference. I guess I can modify this PR so that login()
will throw an exception.
But what make you think that login
should work with JWT?
But what make you think that login should work with JWT?
Auth
as a facade (as in Laravel) for underlying "drivers" (in this case - schemes). I simply assumed that login()
is common for all schemesattempt()
. I thought that, by analogy, there will be also login()
methodWhen Laravel doesn't existed, in stateless auth, you cannot login ( which is way more important than reading the Laravel source code for me )
I'm using Laravel as an analogy.
Also, I think that if there's a facade (eg Auth
) which acts as a proxy for underlying implementations those implementations should have a common interface.
If you think that Jwt::login()
should not do anything, that's fine. Yet I think that this method should exist and simply tell the developer that one should use generate()
instead.
Yes I am in favour of throwing a meaningful exception
Ok, I'll do it.
Should I update this branch, or create a new one with new PR?
You can update this branch itself
Ok, will do so. Thanks!
@thetutlage I've pushed update to PR. Now, login()
will throw an exception.
Looks great thanks 😄
Thank you :)
When using
Jwt
schemeauth.login(user)
fails. It's due to lack of such method inSchemes/Jwt
.This PR introduces
login()
method which is an alias forgenerate()
.