I am trying to use oauth2 with apigility within zf3 project too. At current moment I have faced with next situation: when I am setting ‘deny_by_default’ to true, I get 403 “Forbiddeb” on all pages of the site even at non API urls. I mean, the home page of my site shows 403 too.
I have apigility admin at the another project and generate there what I need. After that I copy generated config to my project.
It looks like I have missed something. When I remove deny_by_default or set it to false everything works as before but my API is allowed to see without authentication.
I have this json response on all pages (at home page too):
@xerkus , I don’t remember exactly but If I am not mistaken the issue was related to that fact that ‘deny_by_default’ and ‘zf-mvc-auth’ was related only to guest users. And I was trying to config apigility for admin user.
I have created additional authorization listener and added something like this:
The deny_by_default flag, when set to boolean true, does exactly what it says: it denies access to API endpoints un-identified users. You MUST pass credentials with your request in order to access any API endpoints. (Non-API endpoints are not affected.)
Your ACL rules may specify further restrictions, but this is the first line in making your API private by default. If you don’t want that behavior, toggle the flag back to false, and then restrict only the endpoints that will require a credentialed user.