php - Google 服务“Oauth2”不存在或之前已被删除 - Composer
问题描述
我正在将 google oAuth 用于 Codeigniter 应用程序,并使用此作曲家库 "google/apiclient": "^2.10",
进行登录,并且在本地环境中运行良好。但它下载了所有谷歌服务,我不想将所有不必要的库上传到服务器。所以我使用以下配置文件删除了所有内容。
composer.json file
{
"require": {
"google/apiclient": "^2.10",
"google/auth": "^1.16"
},
"scripts": {
"pre-autoload-dump": "Google\\Task\\Composer::cleanup"
},
"extra": {
"google/apiclient-services": [
"Drive",
"YouTube"
]
}
}
但是后来我在身份验证时收到了应用程序的错误页面
An uncaught Exception was encountered Type: Error Message: Class "Google_Service_Oauth2" not found
所以我添加了适当的库"Oauth2"
并运行“composer update”命令。
{
"require": {
"google/apiclient": "^2.10",
"google/auth": "^1.16"
},
"scripts": {
"pre-autoload-dump": "Google\\Task\\Composer::cleanup"
},
"extra": {
"google/apiclient-services": [
"Drive",
"YouTube",
"Oauth2"
]
}
}
问题是 "Oauth2"
库没有使用作曲家添加到现有项目中。
注意:我尝试过无线 "pre-autoload-dump": "Google\\Task\\Composer::cleanup"
路更新,但仍然无法正常工作。
有没有办法使用作曲家文件或命令来解决这个问题。感谢您的帮助。
解决方案
谢谢社区,我刚刚找到了答案。
我必须删除apiclient-services
完成的文件夹,然后需要运行 composer update 命令。
资源:
IMPORTANT: If you add any services back in composer.json, you will need to remove the vendor/google/apiclient-services directory explicitly for the change you made to have effect:
推荐阅读
- xml - 删除 Soap 标头和命名空间
- angular - Angular ng serve 在 localhost 上运行良好,但使用 ng build 构建的代码运行缓慢
- java - 如何修复非android java代码中注释@Nullable的gradle javadoc“找不到符号”?
- wordpress - WordPress插件使网站变慢
- email - 受访者提交谷歌表单时如何发送自动定制的电子邮件
- c - 作为输出给出的垃圾值
- java - Java中超类实例方法重载的选择
- android - 如何在共享首选项中添加多个值并将它们加载到 recyclerview 中?
- javascript - 无法登录到嵌入在 iframe 中的网站,并且许多 ajax 发布请求仅在 chrome 中无法在 iframe 问题中工作
- c++ - 切换回 Mac 终端的 Clang 编译器