I'm trying to access public google sheets using google APIs.
Authentication is service accounts, I have .p12/.json file with me. How to proceed with this
Found a solution,
Create a script in google scripts and access sheet through script. And publish script as API.
Done!!
Related
I am building a chrome extension that writes to google sheets and it is working as expected. Currently, I am using my clientID in the manifest.json, but I am wondering how would it work when I publish the chrome extension. I want the user to use their own clientID instead of mine.
Is there a way to update manifest.json with the user's clientID so they don't use mine? Or is there a way to add clientID elsewhere in my script? Or is there another way to write to google sheets without using clientID?
I'm using chrome.identity.getAuthToken every time the user makes the request to google sheets.
I'm trying to get a Google Sheets API Credentials with the least privileges (Viewer) to only access publicly available Google Sheets.
What is the best API Credential configuration for it?
I'm currently using a Service Account with a "Viewer" Role. But it gives access to all of my resources which is something that I don't want.
I know I should create a custom role and assign specific permission to it. What would be the permission for me to do so?
I need to authenticate to an API using OAUTH2, however, it has to be made programmatically, no user typing stuff in a browser is permitted.
This seems like such a simple use case, but I haven't found anything online, the only thing close to it was this post, and the only answer is "yeah, you don't want to use a web browser, but what if you do?"... This doesn't help.
So, please, opening a web browser is not an option, I just want to know if Google provides any way to authenticate purely through code.
Thank you!
In order to achieve your goal, I would like to propose to use the Service account. When the Service account is used, the access token can be retrieved without using the browser.
As the points for using the Service account, please check the following points.
The Service account is not your own Google account.
For example, as one of several situations, if you want to manage a file in your Google Drive using the Service account, please share the file with the Service account. By this, the Service account can access to the file in your Google Drive.
References:
OAuth2ServiceAccount
Several cases using the Service account
Google Drive Access - Service Account or OAuth - To read/write user files
Google service account not being authorized for calendar API
Service Account for google sheets returns not found
I want to upload files to Google Drive using the Google.Apis.Drive.v3 in asp.net MVC. I want my visitor to upload the files to my google drive, I will set the credentials of my google drive in code. Can anyone help me to get this work?
I tried the quick start sample for upload but it asks for the credentials every time. Or it uses the cached credential.
How can I upload a file without knowing the user about the credential?
According to this documentation, you need to get the access credentials to enable the Google Drive. If you want to programmatically access users data without any manual authorization on their part, then perform Google Apps Domain-Wide Delegation of Authority. To delegate authority this way, domain administrators can use service accounts with OAuth 2.0. You can also check on this link which might help.
With the changes to third-party access protection for Google Sheets, calls to the Visualization API now require OAuth credentials unless Spreadsheets are shared to "anyone who has the link can view". (Google Developers Blog Post)(Google Charts Authorization)
Does this still apply to Spreadsheets that are shared to "anyone at domain with the link can view"? If so, how would I get a OAuth credential without prompting the end user for access to their Drive or Spreadsheets? Is it possible to pass a credential using a service account? We do not want to prompt every user that uses the application, since it has been authorized by a Google Apps Administrator and executes using service accounts.
Does this still apply to Spreadsheets that are shared to "anyone at domain with the link can view"?
It is stated in this documentation that:
Google Sheets requires end-user credentials to access private
spreadsheets via the Google Visualization API ("/tq requests")
but Take NOTE that:
Spreadsheets shared to "anyone who has the link can view" do not
require credentials. Changing your spreadsheet's sharing settings is
much easier than implementing authorization.
So if your spreadsheets is shared to "anyone who has the link can view", you are not affected by this update beginning September 14, 2016.
For more information, check this thread.
The "Anyone at domain with the link can view" still requires OAuth credentials, since the application is accessing non-public data. If you are using domain-wide delegation and service account impersonation, you can simply generate an access token in your backend and pass it in the requests to the /tq endpoint.