dingo / dingo/api

Catching exception from oauth

Open
#1,387 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
9.4k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

Hi

I'm using dingo with and oauth2 to authenticate my users. All is good, a part form I'm getting an exception when I pass in incorrect details:

League\OAuth2\Server\Exception\InvalidCredentialsException: The user credentials were incorrect.

I already have a couple of dingo handlers, so I thought I'd have the following:

$app['Dingo\Api\Exception\Handler']->register(function
(\League\OAuth2\Server\Exception\InvalidCredentialsException $exception) {
return Response()->json([
'errors' => [
'status' => 400,
'title' => 'Bad Request',
'message' => 'The user credentials were incorrect'
]
], 400);
});

But for some reason, this handler doesn't seem to handle the exception

Am i going about this correctly?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.