-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Empty response when bad oauth2 credentials supplied (e.g. expired access token) #13
Comments
I have a same problem. If, for example, the access token is invalid, I got an empty body, but in headers have this Originally posted by @developer-devPHP at zfcampus/zf-mvc-auth#99 (comment) |
Your response isn't empty, it's 401 Unauthorized Originally posted by @TomHAnderson at zfcampus/zf-mvc-auth#99 (comment) |
Originally posted by @developer-devPHP at zfcampus/zf-mvc-auth#99 (comment) |
But I think it should be something like this {
"type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html",
"title": "Unauthorized",
"status": 401,
"detail": "Unauthorized"
} Originally posted by @developer-devPHP at zfcampus/zf-mvc-auth#99 (comment) |
10.4.2 does not suggest any body in the response to a 401: Originally posted by @TomHAnderson at zfcampus/zf-mvc-auth#99 (comment) |
Your sentence is perfectly valid but since Apigility provides listeners to marshall responses to ApiProblemResponse in case of responses denoting problems (which include a jSON body) we should be consistent. See also: #108 Originally posted by @nuxwin at zfcampus/zf-mvc-auth#99 (comment) |
I agree with that. I need consistency on JSON response Originally posted by @webaaz at zfcampus/zf-mvc-auth#99 (comment) |
In the authenticate method of the oauth2 adapter (https://github.com/zfcampus/zf-mvc-auth/blob/master/src/Authentication/OAuth2Adapter.php#L135) - if the response is an IdentityInterface, the output is a json that looks like this (due to the SendApiProblemResponseListener, which parses the ApiProblem response which is generated later on):
However - in the case of an error from the response of the oauth2 server (https://github.com/zfcampus/zf-mvc-auth/blob/master/src/Authentication/OAuth2Adapter.php#L154-L156), what returns is a Zend\Http\Response, causing the response to be an empty response with only the 401 status code but without a body (https://github.com/zfcampus/zf-mvc-auth/blob/master/src/Authentication/DefaultAuthenticationListener.php#L189-L191).
This issue started happening to me after I've updated apigility from 1.0.* to the latest.
Originally posted by @dorongutman at zfcampus/zf-mvc-auth#99
The text was updated successfully, but these errors were encountered: