google-drive-api | Name : Khwanchai Kaewyos Email : khwanchai @ gmail | Email library
kandi X-RAY | google-drive-api Summary
kandi X-RAY | google-drive-api Summary
Name : Khwanchai Kaewyos (LookHin) Email : khwanchai@gmail.com.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Upload file to remote server
- Create a new Folder
- List File and Folders
- Get refresh token
- Set new access token from API
- Delete a file
- Get Authorize URL
google-drive-api Key Features
google-drive-api Examples and Code Snippets
Community Discussions
Trending Discussions on google-drive-api
QUESTION
I am trying to get the ID of a file that I have created because I want to move it to a different folder. This is my current code attempting to get the ID:
...ANSWER
Answered 2022-Mar-31 at 15:53The best way to get a file id for a file would be to use the file.list method and the q paramater.
QUESTION
I wanted to upload files to Google Drive using Google Drive API in ASP.NET MVC C#. While doing that I have followed the below URL: https://qawithexperts.com/article/asp-net/upload-file-to-google-drive-using-google-drive-api-in-aspnet/236
While implementing the code after calling my API google redirect to an error page showing
...ANSWER
Answered 2022-Mar-11 at 10:28The redirect uri must exactly match the one you have registered in Google developer console
If we look at your image you have the following two redirect uris registered
- http://localhost:60581/
- http://localhost:60581/api/TwilioWP/CallGoogleAPI
This means that Google will accept only those two redirect uris from your application. The test is an exact match.
Now if we look at the error message we can see that your application is sending
As you can see this does not match the ones you have registered. What you should do is copy that one and add it.
Note if your ide is changing ports you need to set it to a static port or its not going to work. It needs to match exactly
Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications
Your reall issue.The tutorial you are following uses GoogleWebAuthorizationBroker.AuthorizeAsync
This method is designed for use with an installed application. So in fact the credentials and client type you are using is wrong. If you want to use that code you need to create native or desktop client.
If you try to host this as it is it will attempt to open the web browser on the server. When what you need to do is open the web browser for user consent on the users machine. You should be following web-applications-asp.net-core-3 if you want to be able to authorize a user using your web application.
I offer you my tutorial on Asp .net core 3 and Google login which has a link to the YouTube video on the same topic.
So the real cause of your problem is that you are using code for an installed application which has a default redirect Uri of http://127.0.0.1:{Port}/authorize/
and you are trying to use this for a web application. Which will need to have the host set to that of your web domain.
I have been in touch with the author of the tutorial you are following. I suspect they will be addressing the issue soon. Twitter thread
QUESTION
I used below script to get the blob of abc.dat
file which is generated via my Apps Script project. With the Drive service, it is easy.
Used oauthScope is https://www.googleapis.com/auth/drive.readonly
ANSWER
Answered 2022-Mar-09 at 13:01I think that in your situation, it is required to use get
method instead of export
method. Because export
method is used for Google Docs files (Document, Spreadsheet, Slides and so on). When your script is modified, how about the following modification?
QUESTION
I'm trying to upload files using the Google Drive API and am getting a URI mismatch error from Google when clicking the upload button on my page. The URI that Google shows isn't even a part of the website, nor is a URI that I supplied to Google, so I have no idea where it's coming from.
Here is the APIHelper class I created based off of this tutorial (which shows that the code should work on a website)
...ANSWER
Answered 2022-Feb-04 at 11:53The URI that Google shows isn't even a part of the website, nor is a URI that I supplied to Google, so I have no idea where it's coming from.
The redirect uri is built buy the client library you are using. Your app is set to run http not https its running localhost and not hosted so its 127.0.0.1 the port is also either being randomly generated by your app or something that you have set up statically. the /authorize is attached again by the client library.
The redirect uri is the location your code is prepared to accept the response from the authorization server. This URI needs to be configured in Google cloud console. The easiest solution is to copy it exactly and add it as a redirect uri in Google cloud console. Just make sure that your app is set to use a static port if the port changes its not going to work.
This video will show you how to add it. Google OAuth2: How the fix redirect_uri_mismatch error. Part 2 server sided web applications.
Web applicationsQUESTION
Hello all,
I would like to download google-drive files directly to a folder on my pc rather than the standard download folder. Also, the name of the file should stay the same and not manually set.
I have tried downloading the files using the direct download link which downloads the file but you cannot decide where the file saves on your computer.
I also have tried these methods:
https://stackoverflow.com/a/39225272/13715296 (This method did not work for me)
https://stackoverflow.com/a/47761459/13715296 (With this method I could not have the original name of the file)
In my code I basically have a lot of these type of urls:
https://drive.google.com/file/d/xxxxxxxxxxxxxxxxxxx/view?usp=drive_web
But I can easily convert them to these direct download urls:
https://drive.google.com/u/0/uc?id=xxxxxxxxxxxxxxxxxxx&export=download
I just have not found a method on how to download the files using python to a specific folder while keeping the original name of the file the same.
SOLUTION
With the method suggested by @Jacques-GuzelHeron I have now this code:
...ANSWER
Answered 2022-Jan-18 at 09:29I understand that you have an array of Drive file links, and you want to download them locally using Python. I am assuming that you want to to download files stored on Drive, not Workspace files (i.e. Docs, Sheets…). You can do it very easily by following the Drive API Python quickstart guide. That walkthrough will install all the necessary dependencies and show you an example code. Then, you only have to edit the main function to download the files instead of the sample operations.
To download the Python files you only need to know its id and use the Files.get
method. I see that you already know the ids, so you are ready to make the request. To build the request you should introduce the id of the file and set the parameter alt
to the value media
. If you are using the example from the paragraph above, you can do it just by using the id like this example. If those guides don't work for you, please let me know.
QUESTION
I found here
...ANSWER
Answered 2021-Nov-09 at 14:25You need to add the X-Goog-Drive-Resource-Keys
header in your request. The simplest way to do that in the client libraries is via request interceptors. It's a little clunky, but not actually complicated:
QUESTION
For reference, I followed this site https://qawithexperts.com/article/asp-net/upload-file-to-google-drive-using-google-drive-api-in-aspnet/236 on how to upload a file to Google Drive in a Web Application.
This is my code to get the DriveService
...ANSWER
Answered 2021-Oct-05 at 18:32The first problem you are having is that you are using GoogleWebAuthorizationBroker.AuthorizeAsync
which is designed to work with installed applications only its not going to work with Asp .net
For asp .net MVC you should be doing the following
QUESTION
Context and problem:
I am trying to extract the speed limits of some roads using the Google Roads API. When I try to execute the basic example described on the website, I get the error HTTPError: HTTP Error 403: Forbidden
. I am using the following code:
ANSWER
Answered 2021-Jun-22 at 14:51There is no issue with your code.
The code you provided matches exactly with what I have used to perform the same test.
There is an account issue with your permission to access that API. If you are unable to find the issue in your settings, I would recommend reaching out directly to Google.
QUESTION
I am developing a mobile app (in Flutter) that can read and write files in a specific folder in the user's Google Drive.
Users can also manually upload files to this folder and the app must have access to these files.
So far, I am using drive.file
scope and did not manage to have access to the files that the user has uploaded manually.
Do I need to use drive
scope?
Is there any way to use the driver picker in my app and grant full access to a folder?
I would prefer to use drive.file
scope. (The difference is that 'drive.file' only gives you permission to files that your app has created or the user has explicitly shared with your app). But I don't know how to explicitly share a folder with my app.
ANSWER
Answered 2021-Jun-21 at 09:38The https://www.googleapis.com/auth/drive.file
scope allows you to give a per-file access to files which have been created or opened by your app. Therefore, if the files have been upload manually and not from your app, this scope won't give you the access you require.
As for sharing the files with your application, you might find useful the example listed here in order to prompt a user to share the files wanted.
ReferenceQUESTION
Created trigger on custom object. And to create folder will call @future method to support rest API calls. But I am not getting the proper code or guidelines to follow for folder creation in google drive.
Found below links for folder creation but I am not getting it Link 1 Link 2
Also I have the integration of my org and my drive because for one of my visualforce page I want to show drive picker for file selection and it is working correctly. But for folder creation I am not getting how to call methods one by one? For example to authenticate and then create folder.
Please help us and let me know if you want any other details.
...ANSWER
Answered 2021-Mar-11 at 14:28You can call @future method from trigger and can call create folder method by using access token and correct parameters. You can refer below code for folder creation.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install google-drive-api
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page