Auth()->check()
keeps returning false. The api is has api middleware only and I want both guests and logged in users to use it.
I tried taking the authorization token from the request header, but I don't know of any way to check which user has this token.
if(Auth()->check()){
//return extra data
} else {
//return something else
}
Why is Auth()->check()
is always returning false even though Ive bearer token inside the header?? It should return true if the header has a token
you may specify guard name
if(auth('api')->check()){
//return extra data
} else {
//return something else
}