class ApiController extends Controller
{
public function beforeAction($action) {
// Do it here if you want auth a user for each action
}
public function actionAuth($token)
{
$user = User::find()->where('token = :token', [':token'=> $token])->one();
if (!$user) {throw new Exception('403')}
}
}