Google chrome extension 铬延伸与laravel交叉原点

Google chrome extension 铬延伸与laravel交叉原点,google-chrome-extension,laravel-5,cors,Google Chrome Extension,Laravel 5,Cors,我正在创建一个chrome扩展来与我的laravel应用程序通信 我已经在我的项目上配置了 我在app.php文件中添加了这一行: Barryvdh\Cors\ServiceProvider::class, 我将cors中间件添加到我的路由组: Route::group(['prefix' => 'api/', 'middleware' => ['cors']], function () { // routes ... }); 在我的chrome扩展中,我使用$http调

我正在创建一个chrome扩展来与我的laravel应用程序通信

我已经在我的项目上配置了

我在app.php文件中添加了这一行:

Barryvdh\Cors\ServiceProvider::class,
我将cors中间件添加到我的路由组:

Route::group(['prefix' => 'api/', 'middleware' => ['cors']], function () {
    // routes ...
});
在我的chrome扩展中,我使用$http调用我的路由:

$http({
   url: 'http://localhost:8000/api/bookmarks',
   method: 'GET'
}).then(function (data) {
    console.log(data);
}).catch(function (err) {
        console.log(err);
})
在chrome调试器中,我遇到以下错误:

XMLHttpRequest cannot load http://localhost:8000/api/v1/bookmarks. 
No 'Access-Control-Allow-Origin' header is present on the requested resource.   Origin 
'chrome-extension://ndgoclipaencbojjmcfkohfekdbhdnjf' is therefore not allowed access.
我尝试了在github或stackoverflow上找到的许多解决方案:

在index.php
标题(“访问控制允许源代码:”)中添加此项

将默认标题配置更改为角度:

app.config(['$httpProvider', function($httpProvider) {
    $httpProvider.defaults.useXDomain = true;
    $httpProvider.defaults.headers.common = 'Content-Type: application/json';
    delete $httpProvider.defaults.headers.common['X-Requested-With'];
}]);
更改VerifyCsrfToken类上的$execpt属性:

protected $except = [
    'auth/*', 'api/*'
];
我的配置中遗漏了什么

谢谢你的帮助

编辑

我还将此添加到manifest.json文件中:

"permissions": [
  "activeTab",
  "http://localhost:8000/*"
]

在将localhost权限添加到清单后,是否重新加载了扩展?如果设置了权限,则无法获取引用的错误。谢谢sanchez。我已经多次重新加载扩展,现在它可以工作了。然后您可以接受“关闭为重复投票”,因为最初的问题是缺少
权限