Google Apps Script oAuth 2.0 - google-apps-script

I'm using Google Query and Google Apps Script to create information pages (draw tables, graphics etc) inside Google Drive.
Since yesterday all pages, that I've created, are falling down with this message:
Error in query: ACCESS_DENIED. This spreadsheet is not publicly viewable and requires an OAuth credential.
I understand that Google wants me to use oAuth 2.0 however I'm unsure how to do this since every page is enabled only for registered Google users and of course it requires basic Google authentication.
Does anyone have any ideas on how to include oAuth 2.0 into Script inside Google Drive, which is already using oAuth 2.0 (At least I guess it is)?

There are a number of ways of using OAuth 2.0 within Google Apps Script depending on what you're trying to achieve. See here and here, for examples.
Perhaps you could post your sample code, explaining what you're looking to do and where it is going wrong?

We had this problem couple of days ago. We created an add-on which helped us resolve the following problem. Please go through this link to
create an add-on
Then gapi js was able to communicate with our spreadsheet even when private. Hope it helps.

Related

Get Google Drive video view count from Apps Script API?

I have a series of videos uploaded to a specific Google Drive folder, and I'd like to get the view count for each video/file. Literally as simple as "file_id" "10 views".
From extensive research, it seems this is quite simply impossible within Google Apps Script today? Per this old answer, both the Drive API and the Drive Activity API only report edit or comment activity, while view activity is ignored. The Reports API does support this, but only for users with Admin access in an Enterprise account (not for us plebes who just want to know view counts on our own files).
And per this Apps Script documentation, it seems that onOpen() triggers don't run for views (which blocks a "view_count + 1 on open of this specific file" sort of analytics).
Before I give up, I figured I'd run it past this brilliant community: am I missing anything? Is there some way to get view count on videos stored and accessed through Google Drive?
Answer:
You are correct in your findings that you can not get video view count information through the Drive API. You must use the Admin SDK to obtain this information.
Feature Request:
You can however let Google know that this is a feature that is important for access to their APIs, and that you would like to request they implement it.
Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services, I'd urge you to make a feature request there. The best component to file this under would be the Google Drive component, with the Feature Request template.

Third-party conferencing in Google Calendar from Google Apps Script

Is it possible to add third-party conferencing via Google Apps Script yet?
I'm referring to the functionality mentioned here: https://www.blog.google/products/g-suite/bring-teams-together-new-g-suite-integrations/
If not, is there any way to get access to it e.g. getting whitelisted?
Posting for documentation.
After going over the event documentation there does not seem to be a way to programmatically work with third-party conferencing. I created a feature request, this link will serve to keep track of updates on this issue.

Publish Apps Scripts Web App on the Google Apps Market Place

I have a Google Apps Scripts web app and I would like to publish it on the Google Apps Market Place. I followed this instruction (https://developers.google.com/apps-script/guides/domain-wide-web-app) to properly setup the Apps Market Place SDK but I have some troubles.
To test installation flow I use the button in the setup page of the API, so :
My issue is if a user install the app as I allow personal install
The user validate rights and after he is redirected to the application. There I have an issue because the apps script web app request a "Offline access" in a new pop up.
=> I don't know how to add this scope because I don't find any scope for this need to add in the market place SDK setup.
What I found on stackoverflow is I probably have this message because on scope request by apps script web app there is the approval_prompt parameter set to force.
My question is how to avoid that and allow user to connect to app after validating scope on the apps market place ?
Thank you,
Stéphane
You can follow the List of Best Practices
Before you publish your Google App Marketplace application, please review the following list of best practices. Adhering to these best practices will help your application make it through the Google Apps Marketplace review process smoothly without you needing to make additional changes.
This document explain:
3: Define your scopes properly
All OAuth2.0 scopes must be defined in the Google Developer's Console, in the Scopes section of the Google Apps Marketplace SDK. This is essential in order to achieve one-click or zero-click SSO, as described in the following section.
According to this previous question, in the Admin Conso

Getting Google+ Domain API to work in Google Apps Script

I have read loads of good documentation and example for getting external API's to work in Google Apps Script and also access Google API's with OAuth and have successfully integrated them. I can't however find any help with getting the Google+ Domains API https://developers.google.com/+/domains/ working in GAS.
I understand its a little different as it has the capability to do domain wide delegation of authority (which is what I want).
If anyone can help point me in the right direction that would be great.
Many thanks.
I have created a short sample code for the Google+ Domains API with Apps Script.
Please see the gist below.
https://gist.github.com/soundTricker/7130533
Sorry to say, but it's not possible to edit data on other users in the domain with the "Google+ Domains Service"
It tells you in the second part on the first page:
https://developers.google.com/apps-script/advanced/plus-domains
"This service doesn't support the domain-wide delegation feature in the underlying API. This means that domain admininstrators are not able to run a script on behalf of users in their domain."
This is really sad, it would have been so nice if it was possible! Please G00glez fix this =)

Pulling Google Apps user creation date

What options are there to pull a GApps user creation date?
I saw that the Admin SDK is capable of it, is it the only API capable of doing this? does any of the previous one also capable of?
If possible using GAS, it will be most excellent,
Thank you!
Indeed there does not seem be Google Apps Script services to pull the creation date. The DomainUser class provide interesting functionality for interacting with domain users (only for admins).
Using the Admin SDK with Google Apps Script using UrlFetchApp.addOAuthService is not as complex as it looks. You can read this answer which will throw some light on how you can use external API calls for certain Google API and bring the data to Google Apps Script.
The scope for the ADMIN SDK will be as follows
oAuthConfig1.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken
?scope=https://www.googleapis.com/auth/admin.directory.user.readonly");
Notice that in this case I have requested a readonly scope.