I’m working on a mobile application that handles file operations through HTTP requests. My app was working great with the old GData Document List API for uploading files, downloading content, and getting folder listings.
Now I’m trying to upgrade to Google Drive API v2 but running into problems. When I switch my authentication scope from the old docs feed URL to the new drive API scope, I get a 400 error response.
I found out I need to set up the API console for Google Drive SDK, but there’s a required field called “Open URL” that doesn’t make sense for my use case. My app is just a simple file manager and doesn’t need to open existing Drive items.
Has anyone found a way around this requirement? I’m using OAuth2 for devices flow and getting an “invalid_scope” error when trying to authenticate with the new API scope.
The authentication works fine with the legacy scope but fails with the newer Drive API scope. Any suggestions would be helpful.
OAuth2 device flow with Drive API v2 migration is a pain. I did this exact same transition last year - Google changed how they validate scopes between the old and new APIs. You need fresh OAuth2 credentials specifically for Drive API. Don’t reuse your old Document List API ones. For the Open URL field, just use your app’s homepage URL (doesn’t really matter functionally). Main thing is making sure your OAuth2 client type matches what you’re actually doing. Since you’re using device flow, double-check you picked the right application type in the console. That 400 error sometimes happens because of cached credentials - try clearing stored tokens and re-auth from scratch.
Had the same issue a few months ago. The open URL requirement is pointless for file management apps - just throw in example.com and you’re good. Don’t mix up your client credentials though, Drive API v2 needs its own set. Also double-check you enabled the Drive API in the APIs section, not just the SDK part. Sometimes takes a few minutes to kick in after enabling.
I encountered a similar issue while transitioning from the Document List API to Drive API v2. In my case, I was able to handle the “Open URL” requirement by simply inputting a placeholder like “http://localhost,” as my app doesn’t open Drive items directly. Additionally, be sure to register for the Drive SDK section regardless of your intended functionality. It’s crucial to verify your scope string; either “https://www.googleapis.com/auth/drive” or “https://www.googleapis.com/auth/drive.file” should be used based on your needs. Also, ensure that the Drive API is activated in your project’s API library, not solely in the SDK configuration. The invalid_scope error typically indicates that the scope string may be incorrect or the API is not correctly enabled.