Kiran Koravi
Kiran Koravi

Reputation: 164

How use OAuth 2.0 client ID for calling Google Drive API?

I developing one project, Where I want fetch list of all spreadsheets of authenticated user. for this purpose I'm using following API

https://www.googleapis.com/drive/v3/files?key={YOUR_API_KEY}

When I run above API in APIs explorer, it runs well & gives me file list associated with user.

But when I try to run same API in browser copying URL in address bar it gives me an error.

I suppose use clientID Oauth 2.0 in order to access data of authenticated user. But I've no idea how to use clientID though I've created Oauth Client ID

Upvotes: 0

Views: 414

Answers (1)

ReyAnthonyRenacia
ReyAnthonyRenacia

Reputation: 17613

When you used the Google API explorer to execute your API request, the API explorer asked for your permission, hence you undergone OAuth authorization. When you copy pasted the URL with the API key and tried to execute it on browser you got an error. That error is probably insufficient permission. API key is not enough. You have to use the OAuth flow. Refer to the Drive Android Quickstart as it involves the OAuth flow.

Upvotes: 1

Related Questions