Node.js File Upload to Google Drive: A Beginner's Tutorial

  Рет қаралды 24,398

DAIMTO Developer Tips

DAIMTO Developer Tips

Күн бұрын

Пікірлер: 108
@narg3931
@narg3931 3 жыл бұрын
Trying this out for our project! Where can I get the value for the "parents" as shown on timestamp 6:30 ?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
Check out this video kzbin.info/www/bejne/o2TIpqqOmNqpqNU
@narg3931
@narg3931 3 жыл бұрын
@@DaimtoAps Thank u :D
@DaimtoAps
@DaimtoAps 3 жыл бұрын
hope it helps
@gekobcint4973
@gekobcint4973 Ай бұрын
Mam, I don’t know you but, I wish you all the best this really saved me.
@yerst2
@yerst2 2 жыл бұрын
Thank you sooo much for this! This saved me so much time and is exactly what I needed!
@romanryaboshtan9270
@romanryaboshtan9270 2 жыл бұрын
7:45 you can write media, and all it's a shorter object fields write form
@samehkorashee9925
@samehkorashee9925 Жыл бұрын
your method is the only one work around , big fat thanks ♥
@DaimtoAps
@DaimtoAps Жыл бұрын
anytime 😊
@samehkorashee9925
@samehkorashee9925 Жыл бұрын
@@DaimtoAps actually i done that method on my webhost as an automatic backup in the cron, so its perfect
@tmfishing90
@tmfishing90 2 жыл бұрын
Very detailed and excellent instructions. thank you very much. Save me for my day 😀
@nabillamauludina2749
@nabillamauludina2749 2 жыл бұрын
Thank you it helps me really much
@stormerthe2nd
@stormerthe2nd 3 жыл бұрын
thank you so much for this video, a service account makes this all so easy
@DaimtoAps
@DaimtoAps 3 жыл бұрын
I agree!
@Alen_Thomas_
@Alen_Thomas_ 2 жыл бұрын
I've to store uploaded images from my website in 2 separate folders. Can i move those folders to drive and retrieve the images from drive ??
@DaimtoAps
@DaimtoAps 2 жыл бұрын
you can but its really not an optional solution. drive wasn't intended as file hosting. you may have issues with users accessing the files
@adityachandran7002
@adityachandran7002 Жыл бұрын
THIS WORKED FOR ME !!!!!! thanks alot
@DaimtoAps
@DaimtoAps Жыл бұрын
That's good to hear I love knowing I helped
@MrAvelino2010
@MrAvelino2010 3 жыл бұрын
Can you make one, upload to particular folder and subfolder
@DaimtoAps
@DaimtoAps 3 жыл бұрын
Yes you just have to set parents in the metdata object and that will set the parent folder.
@MrAvelino2010
@MrAvelino2010 3 жыл бұрын
@@DaimtoAps i tried following the guide from documentation.but don't return the folder id to store the file there
@ankit3478
@ankit3478 3 жыл бұрын
Error: Could not load the default credentials. -->im getting this error even I have used the correct credentials
@DaimtoAps
@DaimtoAps 3 жыл бұрын
Sounds like it cant find the credentials.
@VitaoPlays
@VitaoPlays 3 жыл бұрын
I'm having the same problem here. Did you find a way to fix it?
@informationtechnology3393
@informationtechnology3393 2 жыл бұрын
Sorry... I am editing my question... Can a service account open files too? or just create them?
@DaimtoAps
@DaimtoAps 2 жыл бұрын
you would need to convert it to a Google doc and use the Google docs API to access it
@projetoskumon6095
@projetoskumon6095 3 жыл бұрын
Excellent! Thanks for sharing your knowledge!
@brightertomorrow3343
@brightertomorrow3343 3 жыл бұрын
Great tutorial
@DaimtoAps
@DaimtoAps 3 жыл бұрын
Glad you think so!
@wejesuss-1104
@wejesuss-1104 2 жыл бұрын
How do I know if the API I want to use accepts service accounts? I want to upload a video to KZbin
@DaimtoAps
@DaimtoAps 2 жыл бұрын
Check the documentation if it doesn't mention it it doesn't support it. The KZbin API does not support service accounts.
@wejesuss-1104
@wejesuss-1104 2 жыл бұрын
@@DaimtoAps yeah, I found it a few days ago
@vladkrutenyuk6715
@vladkrutenyuk6715 2 жыл бұрын
How can I make the same but without service account? I want when you open web page then firstly you should sign-in your google acc and all drive requests will be for you account you chose...
@DaimtoAps
@DaimtoAps 2 жыл бұрын
Try following the official example it uses standard oauth2 developers.google.com/drive/api/v3/quickstart/nodejs
@livingjoke3083
@livingjoke3083 2 жыл бұрын
Was wondering why this example is not shared in a GitHub rep? Makes the process so much easier for new learners that need to understand how this API works.
@DaimtoAps
@DaimtoAps 2 жыл бұрын
All samples should be shared on my website. The exact sample I use in videos will be able on GitHub in the future for patreon supporters
@livingjoke3083
@livingjoke3083 2 жыл бұрын
@@DaimtoAps Well, the issue is that those code samples for this particular project are nothing but methods and declarations. Would be nice to see how you wrap it all together. How you import stuff into the js file etc.
@DaimtoAps
@DaimtoAps 2 жыл бұрын
thanks for the feedback! I see your point and will look into it when I get back from vacation.
@dyhia9075
@dyhia9075 2 жыл бұрын
wooow worked like magiiiiiiiiiiic , thaaank yooouuuuu
@DaimtoAps
@DaimtoAps 2 жыл бұрын
you just made my day thanks
@razorjhon2622
@razorjhon2622 Жыл бұрын
is there anyway to upload the file and give permission to specific users and authenticate it in my website using JWT token ?
@DaimtoAps
@DaimtoAps Жыл бұрын
you would have to code that yourself the service account won't limit it for you
@razorjhon2622
@razorjhon2622 Жыл бұрын
@@DaimtoAps oh but the user will be able to access my google drive and see all data i have uploaded but i just wanted to let the user access the files that he should see from JWT token from the frontend
@DaimtoAps
@DaimtoAps Жыл бұрын
Then your frontend need to be the one controlling who has access to what.
@lesmurphy8466
@lesmurphy8466 2 жыл бұрын
This was helpful thank you!!!
@pudder385
@pudder385 10 ай бұрын
Having trouble. I get a 404: File Not found ''. The folder is shared with the service account and I have triple checked everything. Anyone else have this problem?
@DaimtoAps
@DaimtoAps 9 ай бұрын
Is it a file on Google Workspace
@pudder385
@pudder385 9 ай бұрын
@@DaimtoAps I have tried both a g-suite drive and my personal drive with the same results. Is there something more you must do for workspace?
@pudder385
@pudder385 9 ай бұрын
@@DaimtoAps I created a project and service account under my personal google account and it works! But I still cannot get it to work with the gsuite account.
@geraldwaweru3280
@geraldwaweru3280 Жыл бұрын
How's no one getting this error 'gaxioserror login required'? What could I be doing wrong?
@DaimtoAps
@DaimtoAps Жыл бұрын
There is something wrong with your authorization. Open a new question on stack overflow include your code I would be happy to take a look.
@EBay_Dev
@EBay_Dev 3 жыл бұрын
Hi...Greate guide. I have uploaded a bunch of video clips with related subtitles with that specific name. But in the watch mode, I cant see that subtitle... I wonder to know, there is any node.js snippet code to relate clips and movies automatically. Because the number of files is more than I can handle manually?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
I think your looking for developers.google.com/youtube/v3/docs/captions/list
@EBay_Dev
@EBay_Dev 3 жыл бұрын
@@DaimtoAps thanks for you response. I want exact same functionality in google drive not youtube. as I far as I review the google drive API documentation, I think It isn't there.
@backenddeveloper-rx9ye
@backenddeveloper-rx9ye 2 жыл бұрын
can we upload a file to anothers drive based on drive ID ?
@DaimtoAps
@DaimtoAps 2 жыл бұрын
you need to have the owner of the drive account authorize your then you can upload to anywhere they have access.
@backenddeveloper-rx9ye
@backenddeveloper-rx9ye 2 жыл бұрын
@@DaimtoAps what if on the time of folder creation i changed permission of folder of the drive owner ? so anyone can upload file after that ?
@DaimtoAps
@DaimtoAps 2 жыл бұрын
write access requires write authorization of a user. after creating it just add permissions to the user you wish to have access. or write your own interface using a service account
@foobar846
@foobar846 3 жыл бұрын
Great video!!! What is the difference between node package googleapi and *googleapi@39* from google drive api Guides?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
No idea ;)
@doyouknow1948
@doyouknow1948 3 жыл бұрын
Great Video !! Thanks a lot. I have small issue. when I upload id is created. but actually file not uploaded to google drive. need to i share google drive directory with service account. if want how it does ????
@DaimtoAps
@DaimtoAps 3 жыл бұрын
do a files.list see if the file is there. its being uploaded to the service accounts drive account
@ulisesalcaraz8594
@ulisesalcaraz8594 Жыл бұрын
Very good explanation. If the service is in python, does this mechanism of authorization works the same?
@DaimtoAps
@DaimtoAps Жыл бұрын
yes it does
@SteveCirelli
@SteveCirelli 2 жыл бұрын
Thanks you for the video, it's hard to find tutorials on googleapis
@DaimtoAps
@DaimtoAps 2 жыл бұрын
let me know if you have ideas for other videos with Google Apis
@SteveCirelli
@SteveCirelli 2 жыл бұрын
@@DaimtoAps Probably could do one on ways to programmatically get folder ids (I have not checked if you did already). How would you find folder located at /x/y/z? That's where I'm headed next.
@brilliantatosam
@brilliantatosam 2 жыл бұрын
Wonderful job
@DaimtoAps
@DaimtoAps 2 жыл бұрын
happy uploading 😊
@hkthktm
@hkthktm Жыл бұрын
where can I get parents id in your code ?
@DaimtoAps
@DaimtoAps Жыл бұрын
do a file.list and find the file id of the directory you are looking for
@buiquocanh3686
@buiquocanh3686 3 жыл бұрын
i upload success but image file show 0kb, what something wrong ?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
If the fie size is 0 then you are not properly uploading the stream. You have only created the file metadata.
@viettran-vm4xi
@viettran-vm4xi 3 жыл бұрын
Great Video
@Carol-ll3po
@Carol-ll3po 3 жыл бұрын
Hi, i got an error as below const auth = new google.auth.GoogleAuth({ ^ TypeError: google.auth.GoogleAuth is not a constructor Checked the code and the key file all is corrected, not sure if you could advise any possibility that cause the error. Thank you so much for the tutorial!
@shagyfox
@shagyfox 3 жыл бұрын
const { GoogleAuth } = require("google-auth-library"); const auth = new GoogleAuth(keyFile, scopes);
@DaimtoAps
@DaimtoAps 3 жыл бұрын
I agree with the comment below make sure you have added the required.
@DanyDelaCruzM
@DanyDelaCruzM 2 жыл бұрын
@@shagyfox Thanks! it's worf for me!
@Vuru
@Vuru 3 жыл бұрын
Im getting code 401 Invalid credentials error json :(
@DaimtoAps
@DaimtoAps 3 жыл бұрын
Are you sure you created a service account?
@moneyDev1111
@moneyDev1111 2 жыл бұрын
Uncaught Error Error: Could not load the default credentials.
@DaimtoAps
@DaimtoAps 2 жыл бұрын
sounds like an issue finding the file
@nisarggogate8952
@nisarggogate8952 3 жыл бұрын
It was awesome video. I am getting message File Created and its id. But its not visible in my google drive folder which is shared as well as whose id is added in parent inside fileMetaData. Can you please guide what might go wrong? Why is file not visible inside drive?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
Do a file.list see if it was uploaded to the service accounts drive account instead. There may be an issue with the parent you set
@nisarggogate8952
@nisarggogate8952 3 жыл бұрын
@@DaimtoAps actually there was a typo... Got it working 😀 Service account makes it lot easy. Btw I am sending doc from react app to nodejs and nodejs to drive. Got that working too after struggle of 2 days 😂... These small success make me feel sooo good ❤️
@raunaqsingh875
@raunaqsingh875 3 жыл бұрын
From where do i get my KEYFILEPATH ?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
its the path to the key file on your system. Check your hard drive.
@raunaqsingh875
@raunaqsingh875 3 жыл бұрын
Ok thanks I will check
@rodrigeznonames7353
@rodrigeznonames7353 2 жыл бұрын
Thanks a lot! It will be great if you let us know how to push that in Cloud Run afterwords and still have it working ;/
@DaimtoAps
@DaimtoAps 2 жыл бұрын
I didn't have any doubt 🧐
@AndrewMelnychuk0seen
@AndrewMelnychuk0seen 2 жыл бұрын
Fantastic stuff!
@ruchika-0192
@ruchika-0192 2 жыл бұрын
Please menton detailed process
@DaimtoAps
@DaimtoAps 2 жыл бұрын
which process?
@jonasstrabel
@jonasstrabel 3 жыл бұрын
Great video! Is it possible to Upload a file from a variable, without saving it?
@DaimtoAps
@DaimtoAps 3 жыл бұрын
You should be able to do it with any steam. I will have to give it a try 🙂
@chyys_goldenera
@chyys_goldenera 3 жыл бұрын
Thank you
@faizangulzar1973
@faizangulzar1973 2 жыл бұрын
Thank you so much for this!. Can you plz get me this through some php script. Thanks
@DaimtoAps
@DaimtoAps 2 жыл бұрын
I sure can 😁
@faizangulzar1973
@faizangulzar1973 2 жыл бұрын
If you can then plz help me, I am stuck with that.
@lucasfontesgaspareto
@lucasfontesgaspareto 3 жыл бұрын
Thanks so much
@TarunYadav-dp1id
@TarunYadav-dp1id Жыл бұрын
now do this for mf graph.ass api !
@DaimtoAps
@DaimtoAps Жыл бұрын
sorry i dont know that api.
@DaimtoAps
@DaimtoAps 3 жыл бұрын
I have uploaded a companion blog post for this video which contains all of the code you will need to follow along. www.daimto.com/upload-image-to-google-drive-with-node-js/
@geraldwaweru3280
@geraldwaweru3280 Жыл бұрын
I'm stuck on this error 403 GaxiosError: Insufficient Permission: Request had insufficient authentication scopes.
@DaimtoAps
@DaimtoAps Жыл бұрын
Depending upon which method you are calling you need to ensure that you are requesting the proper scope for authorization. You need write access for this call.
@sabrananda
@sabrananda 3 жыл бұрын
thank you so much
Google OAuth with curl: A Complete Tutorial
17:02
DAIMTO Developer Tips
Рет қаралды 25 М.
How I upload files to my google drive account with C#. #googledriveapi
12:46
DAIMTO Developer Tips
Рет қаралды 24 М.
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
How to upload image to Google Drive using Node js
18:05
Code11 Programming
Рет қаралды 6 М.
How to Upload a File to Google Cloud Storage in Node.js
10:34
The intro to Docker I wish I had when I started
18:27
typecraft
Рет қаралды 317 М.
Node.js is a serious thing now… (2023)
8:18
Code With Ryan
Рет қаралды 662 М.
Master Google Sheets with Node.js: Read & Write Data Effortlessly!
14:28
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 690 М.
Storing Images in S3 from Node Server
39:59
Sam Meech-Ward
Рет қаралды 103 М.
This is How I Scrape 99% of Sites
18:27
John Watson Rooney
Рет қаралды 205 М.