what client_secret.json file is it required for google drive files access - google-drive-api

I am getting this error:
File "/usr/local/lib/python3.7/site-packages/pydrive/auth.py", line 388, in LoadClientConfigFile
raise InvalidConfigError('Invalid client secrets file %s' % error)
pydrive.settings.InvalidConfigError: Invalid client secrets file ('Error opening file', 'client_secrets.json', 'No such file or directory', 2)
all I want is to list files and folders using pydrive !
I tried creating credentials but On consent page its showing unverified status.
from the credential page under OAuth 2.0 Client IDs tab I downloaded created credentials and downloaded crediential file secret_json_[.....].json file

Looking into the documentation for pyDrive:
Click ‘Download JSON’ on the right side of Client ID to download client_secret_<really long ID>.json.
The downloaded file has all authentication information of your application. Rename the file to client_secrets.json and place it in your working directory.
So probably you are lacking the last step of renaming the file and placing it in the working directory.
I tried creating credentials but On consent page its showing unverified status.
This should not matter at all, unverified just means that you are trying to access sensitive scopes and until Google verifies your application there would be an extra screen indicating that it is a unverified apps. Is okay for personal/development use.

Related

How create a IPNS file. And download it form internet

I create a file and publish it as ipfs file
$ipfs add file added QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG
next I publish it to ipns
$ipfs name publish QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG Published to k51qzi5uqu5dltd25mh4mbpenvt48ogf896tmzwps60sdsifmh6jbsi5nc432x
and check , resolve correct
$ipfs name resolve k51qzi5uqu5dltd25mh4mbpenvt48ogf896tmzwps60sdsifmh6jbsi5nc432x /ipfs/QmUVTKsrYJpaxUT7dr9FpKq6AoKHhEM7eG1ZHGL56haKLG
trouble is with download it.
curl https://ipfs.io/ipns/k51qzi5uqu5dltd25mh4mbpenvt48ogf896tmzwps60sdsifmh6jbsi5nc432x
is alvays 504 Gateway Time-out
I expect download my data. I wayting about a week.

CLASP Local Login

I'm trying to figure out how to set up a local login file for my google scripts project in order to set it up so it'll work in an automated deploy process.
As far as I can tell, clasp login will create a file in your home directory which authenticates you with scripts.google.com, but that file isn't applicable to to local logins because it's missing some properties like "project_id".
When looking for how to create a file to run with clasp login --creds {file} there doesn't seem to be a straight forward way to generate one of those files in your local directory, which is how I would like to set up my deployment pipeline.
Most of the documentation on the internet says that you can create your own file by navigating to your GCP project and exporting a service account json file, but I don't know how to tell which GCP project my google script project is associated with.
I'm super lost, any help would be appreciated.
Thanks,
Alex
In order to log in locally I performed these steps:
In your project, make sure it's associated with a project id
(in the legacy editor > resources > cloud platform project > set your project id)
Then go to https://console.cloud.google.com/apis/credentials?authuser=0&project=your-project-id, create an Oauth2.0 clientid, and download your client secret and save it locally
From there you can locally log in by running clasp login -creds /path/to/file
Thanks to ALE13 and Error retrieving access token: TypeError: Cannot read property 'project_id' of undefined

upload fail the google api after redirecting to localhost

After I run the following code from:
https://developers.google.com/drive/api/v3/quickstart/python
I get the link:
https://accounts.google.com/o/oauth2/auth?response_type=code&client_id=792377765624-8l03cnfmj1km5gd27227kuaem37okdip.apps.googleusercontent.com&redirect_uri=http%3A%2F%2Flocalhost%3A41245%2F&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&state=8xHuMrgWMisZa7Hww6HpIZrRdkRTjq&access_type=offline
I click it and get new pages.
I was not allowed to upload pictures here,sorry.
Because my score is low in stackoverflow
Finally, it tell me I can not connect to:
http://localhost:44637
Screenshots of the behaviour: https://blog.csdn.net/appleyuchi/article/details/102940981
According to the screenshots you provided and the url you are getting redirected to, the problem is that the Google account with which you downloaded the credentials file is not the same as the one with which you grant authorization to Drive. Both should be the same, because the credentials file contains information that identifies the account that downloaded them.
Check these for further information on the authentication process:
https://developers.google.com/identity/protocols/OAuth2
https://developers.google.com/identity/protocols/OAuth2WebServer

Google Drive DriveCommandLine sample app not working?

Is the Google Drive API sample command line app (DriveCommandLine) currently known to work? I have downloaded the Java client library, and compiled the sample application (inserting my application's client ID and secret created by specifying "installed application" and "other"). It runs and informs me to access the following link in a browser:
https://accounts.google.com/o/oauth2/auth?access_type=online&approval_prompt=auto&client_id=MY_ACTUAL_CLIENT_ID&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/drive
(Obviously with my actual client ID there.)
This successfully provides me with an authentication code. When I enter this at the application's prompt, then at the line:
File file = service.files().insert(body, mediaContent).execute();
I get the exception:
Exception in thread "main" com.google.api.client.http.HttpResponseException: 401 Unauthorized
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:978)
at com.google.api.client.googleapis.media.MediaHttpUploader.executeUploadInitiation(MediaHttpUploader.java:338)
at com.google.api.client.googleapis.media.MediaHttpUploader.upload(MediaHttpUploader.java:252)
at com.google.api.services.drive.Drive$Files$Insert.executeUnparsed(Drive.java:309)
at com.google.api.services.drive.Drive$Files$Insert.execute(Drive.java:331)
at DriveCommandLine.main(DriveCommandLine.java:56)
Investigation shows that the GoogleCredential returned has all elements set to null (which seems wrong).
The version of the Drive API client that I am using is "v2-rev5-1.7.2-beta", which is the one currently pointed to on the quickstart page here:
https://developers.google.com/drive/quickstart
I am compiling and running with this JAR and all the ones in the "libs" subdirectory in the classpath (the quickstart page refers to adding source JARs to the classpath which, obviously, dosn't work).
Can anyone shed any light on what might be going wrong here?
Thanks!
The link in the Quick Start is outdated. Try downloading the Drive SDK from the following link: http://code.google.com/p/google-api-java-client/wiki/APIs#Drive_API
See if that makes a difference for you. I have the DriveCommandLine app running fine.
You need to download JSON file from the API access page at
https://cloud.google.com/console.
Rename this json file as "client_secrets.json"
Copy this json into your project folder or more specifically copy it
into "src/main/resources". (This file contains the clientID and secrets). If the file is already present in the folder then replace it.
Now run the project. You will be redirect to Google Drive's "allow
access" page.
PS - json file must belong to an "Installed Type Application" because this is a commandline sample and runs locally.

Link to document on LAN from web page

I need to link to a file on a Windows file share from a web page.
I have tried using this path:
//B-1152151154/shared/file.txt
...but it says permission denied.
Is it possible to do so, same like accessing a local drive file (C:/shared/file.txt)