api: Type error: Argument 2 passed to Dingo\Api\Auth\Provider\OAuth2::authenticate() must be an instance of Dingo\Api\Routing\Route, null given
Type error: Argument 2 passed to Dingo\Api\Auth\Provider\OAuth2::authenticate() must be an instance of Dingo\Api\Routing\Route, null given
Get this error when running php artisan clear-compiled
Only seen after updating past e842d8c5245ce2ef9f4384409ae8a775d04b2a38 in dev-master. Prior to this commit everything was working.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 24 (8 by maintainers)
same issue, after running
composer updatei am getting this, runningphp 7andLaravel 5.1Hi!
I’m having the same error message in a different context:
Type error: Argument 2 passed to Dingo\Api\Auth\Provider\OAuth2::authenticate() must be an instance of Dingo\Api\Routing\Route, null givenThe error only happens when running tests (phpunit). In a transformer I do:
The instruction
app('Dingo\Api\Auth\Auth')->user();triggers the error.So I tried with helpers (as you mentionned above) :
And the instruction
$this->user;still triggers the error.Do you have any advices ?
More informations:
setUpfunction of the tests (and is executed after a laravel event is triggered)composer installcomposer installthere, but didn’t succeed to reproduce the error.It’s not blocking on my side (as tests pass on my main computer) but I guess it could learn me something, and maybe helps you improving dingo 😃
🍑
@murwa calling
app('Dingo\Api\Auth\Auth')->user()will try to authenticate the user, and then return the user. (and in our cases trigger an error)As a workaround I used
app('Dingo\Api\Auth\Auth')->user(false)it returns the user without trying to authenticate it.I guess it’s fine, because with dingo the authentication is done beforehand, in a route middleware.