You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am currently trying to implement the client in such a way that I am notified when the OAuth2 service is in maintenance mode, i.e. when it returns an HTTP status code 503.
Unfortunately, maybe I'm blind, I don't see any way to get to this status code. I currently get the following message:
Unfortunately, I cannot use this to determine whether the service is in maintenance mode and I can display a corresponding clean message on my page. Is it possible to implement a way to get this information?
The text was updated successfully, but these errors were encountered:
So far I identified the file src/Provider/AbstractProvider.php:
public function getParsedResponse(RequestInterface $request)
{
try {
$response = $this->getResponse($request);
} catch (BadResponseException $e) {
$response = $e->getResponse();
}
I think it's not such a good idea to just catch the error here and pass it on as some kind of regular feedback. In my opinion, an exception should be thrown cleanly as such, so that I can then also deal specifically with the error, as in this case.
When I put the OAuth2 server into maintenance mode, it returns a code 503. Currently, your implementation only returns the message that the access token is not set, if I want to retrieve it. In reality, however, the error is that the server does not respond with the status with which it should respond. The actual error is cascaded through another message and made unrecognisable.
My proposed change would be as follows, although I am aware that tests may fail or that it may also represent a breaking change:
public function getParsedResponse(RequestInterface $request)
{
try {
$response = $this->getResponse($request);
} catch (BadResponseException $e) {
throw new \Exception($e->getMessage(), $e->getCode());
}
Maybe it's a solution, implement public function getAccessToken($grant, array $options = []) with an additional argument , $throwPlanException = false or something like that and add also that argument to getParsedResponse and build there an condition. If $throwPlanException = false, handle everything on the old way. If $throwPlanException = true, throw the exception?
I am currently trying to implement the client in such a way that I am notified when the OAuth2 service is in maintenance mode, i.e. when it returns an HTTP status code 503.
Unfortunately, maybe I'm blind, I don't see any way to get to this status code. I currently get the following message:
Unfortunately, I cannot use this to determine whether the service is in maintenance mode and I can display a corresponding clean message on my page. Is it possible to implement a way to get this information?
The text was updated successfully, but these errors were encountered: