The file token.json stores the user's access and refresh tokens, and is created automatically when the authorization flow completes for the first time.Īnd every time it won't delete token.json or override the file, it will be same. Like If modifying these scopes for changing the permission to access our google drive, delete token.json. In the above piece of code, we need to take care of a few things. const fs = require( 'fs') įs.readFile( 'credentials.json', (err, content) => ) īody: fs.createReadStream( 'C:/Users/bhavya.jain/Downloads/traveltattoo.jpg') Support for authorization and authentication with OAuth 2.0, API Keys and JWT tokens is included.) which helps us to upload the file here. We need to install the above packages first fs(filesystem) which will read-write into a file and do many operations much of you will aware of this package as its basic one.Īnother package is readline (module provides a way of reading a data stream, one line at a time).Īnother one is googleapis(client library for using Google APIs. ![]() If you are creating this feature as a separate project then you need to create a nodejs simple project like you need to do npm init that it will create package.json in your folder and afterward you can create one file which will have this functionality of uploading the file on google drive npm install 39 -saveĪfter that create a file named uploadimage.js const fs = require( 'fs') In your existing project, you need to install this library to implement this feature. The file will have a Client ID and Client Secret which we should not expose to others for security purpose. ![]() ![]() ![]() After clicking on enable button one dialogue box will open up, from there you will get client credentials and it will automatically download the file in your system.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |