php - Google service "Oauth2" does not exist or was removed previously - Composer
Get the solution ↓↓↓I am using google oAuth for the Codeigniter application with this composer library "google/apiclient": "^2.10",
for the login, and works fine on local environment. But it downloaded all the google services and I don't want to upload all unnecessary libraries to the server. So I removed all by using the following configuration file.
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"
]
}
}
But then I received an error page on the application while authentication
An uncaught Exception was encountered Type: Error Message: Class "Google_Service_Oauth2" not found
So I added appropriate library"Oauth2"
and run the `composer update' command.
{
"require": {
"google/apiclient": "^2.10",
"google/auth": "^1.16"
},
"scripts": {
"pre-autoload-dump": "Google\\Task\\Composer::cleanup"
},
"extra": {
"google/apiclient-services": [
"Drive",
"YouTube",
"Oauth2"
]
}
}
The problem is "Oauth2"
library is not adding to the existing project using composer.
Note: I have tried to update without "pre-autoload-dump": "Google\\Task\\Composer::cleanup"
line and still it doesn't work.
Is there any way to fix this using a composer file or command. Thank you for the help.
Answer
Solution:
Thank you community and I just found the answer.
I have to delete the apiclient-services
folder completed and then need to run the composer update command.
Source: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:
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: installation failed, reverting ./composer.json and ./composer.lock to their original content.
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.