Specify Routs Without Authentication In Rest Api

How I can specify routs where authentication is not required in REST API?

Here http://www.yiiframework.com/doc-2.0/guide-rest.html is said: "After authentication is enabled as described above, for every API request, the requested controller will try to authenticate the user in its beforeAction() step."

But is it possible to set actions that do not require authentication (like login, forgot password)?

Create a separate controller for these.

I did this way:

    public function beforeAction($action)



         * Remove authentication for specified routes


        if(in_array($action->getUniqueId(), $this->noAuthRoutes))


        return parent::beforeAction($action);


public function behaviors()


    $behaviors = parent::behaviors();

    $behaviors['authenticator']['except'] = $this->noAuthRoutes;

    return $behaviors;