thephpleague / oauth2-server-bundle

Symfony bundle for the OAuth2 Server.
MIT License
176 stars 86 forks source link

Handle 401 API #161

Closed emmanueldevins closed 3 months ago

emmanueldevins commented 9 months ago

Hi there There is a way to handle the default response "The resource server rejected the request." 401 when the token (from clientid/secret token auth) is expired ? Bests

SherinBloemendaal commented 7 months ago

It seems not possible at the moment since the League\Bundle\OAuth2ServerBundle\Security\Authenticator\OAuth2Authenticator is final thus no way of extending it.

It would be nice if it responds in the format sent in the Accept header and implement something like rfc7807 (jsonproblem) for json requests.

chalasr commented 3 months ago

PR welcome to improve error responses, the Symfony built-in ProblemNormalizer that could be useful for what's proposed. Also please consider using Discussions for support questions. Thanks