Google has made it really easy to create api credentials for own use, just follow these few steps:
- Go to Google Cloud Console
- Create a new project (or select an existing) from the menu [screenshot]
- Search for
drive api
in the search bar and selectGoogle drive api
under the marketplace section [screenshot] - Click to enable
Google Drive API
button [screenshot] - Click on the
Credentials
menu item - Click on the
Configure Consent Screen
button [screenshot] - Select
External
user type (Internal is only available for workspace subscribers) [screenshot] - Click on the
Create
button - Fill out the fields
App name
,User support email
,Developer contact information
with your information; you will need to put the Project ID into the app name (keep the other fields empty) [screenshot] - Click the
Save and continue
button. If you getAn error saving your app has occurred
try changing the project name to something unique - Click the
Add or remove scopes
button - Search for
google drive api
- Select the scopes
.../auth/drive
and.../auth/drive.metadata.readonly
[screenshot] - Click the
Update
button - Click the
Save and continue
button [screenshot] - Click the
Add users
button - Add the email of the user you will use with gdrive [screenshot]
- Click the
Add
button until the sidebar disappears - Click the
Save and continue
button [screenshot] - Click on the
Credentials
menu item again - Click on the
Create credentials
button in the top bar and selectOAuth client ID
[screenshot] - Select application type
Desktop app
and give a name [screenshot] - Click on the
Create
button - You should be presented with a Cliend Id and Client Secret [screenshot]. If you dont copy/download them now, you may find them again later.
- Click
OK
- Click on
OAuth consent screen
menu item - Click on
Publish app
(to prevent the token from expiring after 7 days) [screenshot] - Click
Confirm
in the dialog
Thats it!
Gdrive will ask for your Client Id and Client Secret when using the gdrive account add
command.
Then you will be pointed to a URL, where you confirm access to your Google Drive data.