企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## 安装浏览器插件 这里选用360浏览器进行API调试 首先下载跨域请求插件[kancloud-api-plugin-proxy-0.0.2.crx](https://box.kancloud.cn/kancloud-api-plugin-proxy-0.0.2.crx) 在浏览器地址栏中输入chrome://extensions/ ,将插件拖入进去,进行安装。 ## 1.新项目安装laravel passport 执行: `php artisan passport:install` 命令 ## 2.用户登录权限验证 获取用户权限的接口时(例如:个人中心)需要在headers传入如下参数: ~~~ "Accept":"application/json", "Authorization":"Bearer+空格+登录时获取到的token" ~~~ 例如: ~~~ $.ajax({ headers: { Accept: "application/json", Authorization:"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjhiYjk4MWQ1OTA3Y2ViMTIwN2I3NTk0ZGNhOTA5NDgyNTEzMDUxZmVmMzViOTc2NzUyYmZmNGEwZDg3MmRlOGZiNjRiM2VjNDFiYTg3NzZhIn0.eyJhdWQiOiIxIiwianRpIjoiOGJiOTgxZDU5MDdjZWIxMjA3Yjc1OTRkY2E5MDk0ODI1MTMwNTFmZWYzNWI5NzY3NTJiZmY0YTBkODcyZGU4ZmI2NGIzZWM0MWJhODc3NmEiLCJpYXQiOjE1MTk3MjE4NjUsIm5iZiI6MTUxOTcyMTg2NSwiZXhwIjoxNTUxMjU3ODY1LCJzdWIiOiIxIiwic2NvcGVzIjpbXX0.DODgtE9iT3EwkvK1jI7BFA4FsKHXObl8m77dOQQuGty9tgX1MgVReRjKJ029nv3VxbXeK4-SLrWc6_7BdxEeZztu6nr_FxyQt7GUO8YH5BuIDRyF9yghNtDyv9d77hs0oxQqOWaNVrmAjVyr4e059TRNX5j1WHCQsANPL_IVsLI0MzD9y1lXlw9MowzFrl4Q5WfUr6N06GBV0qP78cRMMY1uGBVkNQCLEaF5txfgVWMvvzsPSHSP7vJsZrCWtqrrvugEiisKhEo6r8tft0h6Bb3KRaNifFW0tZrP4oNfNeRPe3OQ3HCeSfQRDP4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