Api: Message Error Authenticate users

Created on 16 Apr 2018  路  3Comments  路  Source: dingo/api

| Q | A
| ----------------- | ---
| Bug? | no|yes
| New Feature? | no|yes
| Framework | Laravel
| Framework version | 5.6
| Package version | 2.0.0-alpha1
| PHP version | 7.1.10

Actual Behaviour

When the user is not authenticated, the error appears:
"message": "Type error: Argument 1 passed to Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException::__construct() must be of the type string, null given, called in
"C:\xampp\htdocs\doc3w\vendor\dingo\api\src\Auth\Auth.php on line 113".

Expected Behaviour

Reviewing the code in the throwUnauthorizedException method of auth.php (vendor\dingoapi\scrauthauth) it appears that if the exception is null, the field is null and void and if we put "" the error appears: "message": "Failed to authenticate because of bad credentials or an invalid authorization header.",

Thx Alejandro

Most helpful comment

Usage of v2.0.0-alpha2 fix the problem.

"require": {
        "dingo/api": "2.0.0-alpha2",
}

All 3 comments

Usage of v2.0.0-alpha2 fix the problem.

"require": {
        "dingo/api": "2.0.0-alpha2",
}

Thanks! Upgrading to alpha2 worked for me.

Was this page helpful?
0 / 5 - 0 ratings