I'm using yii-powered app as backend of public API. I created controllers/ApiController
class with actionTest
method and trying to get some data by url domain.ltd/api/test
without authorization by login/pass which usually need for another controllers (SiteController, for example). How can I do this?
I think there are few variants:
To allow anyone to access that page, just specify that in rules of controller (similar to login page, as you can access it without logging in)
public function accessRules()
{
return [
[
'allow',
'actions' => ['test'],
'users' => ['*'],
],
['deny', // deny all users
'users' => ['*'],
],
];
}