[Vuejs]-Vue js axios get request error – Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present

0👍

Finally i found the answer.It was an issue of using cors along with authentication.I just added my cors filters above the authentication like below.Before it was below the authentication

public function behaviors()
    {
        $behaviors = parent::behaviors();
        unset($behaviors['authenticator']);
        $behaviors['corsFilter']=[
            'class' => \yii\filters\Cors::className(),
            'cors'  => [
                'Origin'=> ['http://localhost:8080'],
                'Access-Control-Allow-Credentials' => true,
                'Access-Control-Allow-Headers' => ['Authorization'],
            ],
        ];
        $behaviors['authenticator'] = [
            'class' => JwtHttpBearerAuth::class,
        ];
        return $behaviors;
    }

Leave a comment