I’m working on a Ruby application that integrates with Google Drive API and running into authentication problems.
My current workflow involves creating an OAuth2 client and successfully authenticating. I start by calling the Google Documents List API to retrieve file information, then use those file IDs to make requests to the Drive API.
When I try to access files using this endpoint pattern:
GET https://www.googleapis.com/drive/v1/files/1A8M742jGxQS6NlGfbTBxxxxxxx?access_token=ya29.AHES6ZTdlKX3mYhD7sjsVuI8AAxxxxxxxxx
I keep getting this error response:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "appNotInstalled",
"message": "The authenticated user has not installed the app with client id yyyyy.apps.googleusercontent.com"
}
],
"code": 403,
"message": "The authenticated user has not installed the app with client id yyyyy.apps.googleusercontent.com"
}
}
The strange part is that my OAuth2 credentials work perfectly fine with the Google Docs feeds API endpoints. I can access those without any issues using the same client configuration.
My scope configuration includes comprehensive permissions: 'https://docs.google.com/feeds/,https://docs.googleusercontent.com/,https://spreadsheets.google.com/feeds/,http://gdata.youtube.com,plus.me,drive.file,userinfo.email,userinfo.profile'
I created this client through the Google API Console, not the Chrome Web Store. I’m building a server-side application and don’t need any UI integration with Drive.
Has anyone encountered this specific error when working with Drive API from Ruby? What am I missing in my setup?
I encountered a similar issue a while back when updating an older Ruby application. Google’s API behavior can differ significantly between versions, and while your OAuth token may work for older APIs, the Drive API is stricter regarding app registration and supported scopes. The ‘appNotInstalled’ error you see often arises from an inconsistency between your OAuth client configuration and the API being accessed. Ensure that your OAuth client in the Google Cloud Console is set as a ‘Web application’ rather than ‘Installed application’ since you’re building a server-side application. Furthermore, it seems like you are using a mix of old and new scope formats; I recommend using only the updated OAuth 2.0 scopes like ‘https://www.googleapis.com/auth/drive.file’ to avoid any compatibility issues. This combination of outdated and new scopes could definitely result in the appNotInstalled error even with valid credentials.
hey, are u using v1 of the api? that’s pretty old, try v3 instead. also, double check your oauth scopes, some old ones can cause this kind of error for sure.
The appNotInstalled error occurs when your OAuth2 client type does not correspond with the API endpoint being accessed. Since your configuration works with Google Docs feeds but fails with the Drive API, it indicates that Google maintains different requirements for app authorization across API families. From my experience with Ruby projects, it’s essential to use the correct authentication flow. Make sure you’re implementing the server-side flow for OAuth2 setup, rather than the flow designed for installed applications. Additionally, Drive API v1 has not been supported for years and enforces stricter requirements compared to the old Docs API. I recommend upgrading to Drive API v3 and ensuring that the Drive API is enabled in your Google Cloud Console project, as permissions may not consistently sync across Google APIs, even with valid tokens.