- Clone the Repository
- Create .env File
- Create a Project at GCP
- Enable Google Drive API under Enable API and Services
- Under API and Services Generate a OAuth 2.0 Client ID
- Pase
https://developers.google.com/oauthplayground
as Redirect URI inside the OAuth 2.0 Client ID - Whitelist your Email Address Under OAuth Consent Screen section
- Go to OAuthPlayground
- Select Google Drive V3 and Paste your Client Id and Client Secret
- Exchange Authorization code with Refresh Token and Access Token
- Add the following inside your .env file which you created earlier
KEY | value | ||
---|---|---|---|
CLIENT_ID | yourClientID | ||
CLIENT_SECRET | yourClientSecret | ||
REDIRECT_URI | yourRedirectURI | ||
REFRESH_TOKEN | yourRefreshToken |
- Place your file at the dir
- Install required packages
- Note: To upload the file run yarn upload "fileName" "mimeType" "folderId (if you want to upload inside a folder)"
- Note: To delete the file you need the files' FILEID and run it as yarn delete 'FILEID'
- Note: To create a folder you need to run yarn createFolder 'folderName'
- Once you are done the setup you only need to run follow Steps after Step 11 everytime.