krisanalfa / lumen-jwt

Lumen with JWT Authentication, Dingo API and CORS Support
258 stars 80 forks source link

Check current authenticated user #37

Closed seuaCoder closed 7 years ago

seuaCoder commented 7 years ago

Hi,

First thank you for this package which makes our life much easier :)

I would like to know if there is a method to get the curren authenticated user but return false if not.

I tried :

$user = JWTAuth::parseToken()->authenticate()

But this is returning a response :

{ "message": "The token could not be parsed from the request", "status_code": 500 } I would like to return true if there is the token match an user and false in any case else.

Any help ?

Thank you.