Allow one path for both authenticated and unauthenticated users
I'd like to have one route in my API be able to take requests and return the appropriate results based on whether or not an authentication or authorization has occurred. It seems by default, the path is blocked for unauthorized users. Using bypassAuth doesn't work here. How can I allow unprotected access and let the controller figure it out?
[
'role' => '*',
'prefix' => 'Api',
'controller' => 'Objects',
'action' => ['index'],
],
I want to be able to show some public content for unauthorized users, then show protected content for authorized users.
So, I understand you need an api path like /api/objects/index to be accessed for BOTH authenticated and not authenticated users at the same time, and return results based on that.
In this case you would need to define bypassAuth in your rule to make this action public. What's your problem in this case?
Please specify the version of the plugin you're using. Thanks.