Do I need to change my Apps Script code because Google+ Sign-in feature is being deprecated? - google-apps-script

I got this notification saying that "On March 7, 2019, all Google+ APIs and Google+ Sign-in will be shut down completely. This will be a progressive shutdown, with API calls starting to intermittently fail as early as January 28, 2019, and OAuth requests for Google+ scopes starting to intermittently fail as early as February 15, 2019."
I am asked to "Please update your projects listed below by March 7, 2019 and ensure they are no longer using Google+ APIs, or requesting Google+ OAuth scopes. The data below shows which Google+ API methods your projects have recently called, as well as Google+ OAuth scopes it has requested."
Currently, the authorization is being handled automatically by Google when a user uses a functionality defined by the script that requires access to edit Google Sheets for example.
Here is the doc that shows some migration tips: https://developers.google.com/identity/sign-in/web/quick-migration-guide
My question is do I actually need to do anything to my Apps Script code if I am working only in the Google suite like Google Sheets and Forms to ensure this authorization still works after Google moves from Google+ Sign-In to Google Sign-In. I am not doing API calls from a separate website or anything like that.
Any help would be greatly appreciated!

Do you populate a sign-in button by yourself using Google Apps Script? If so please share some code, there's probably some work to do. I think this should be the case.
When you publish a Google Apps Script you can choose to run it as the owner of the script or the user accessing the the web-app. Depending on the scopes used in Google Apps Script it will require some authorisation, this is fully handled by Google and there's nothing you should do.

Related

Google Add-on for sheets invalid scope

So following this tutorial I am attempting to extend by adding the add-on via the sidebar. [See the screen shot below] []2
But I am getting this error when attempting to add this auth scope.
Error: invalid_scope
Some requested scopes were invalid. {valid=
[https://www.googleapis.com/auth/gmail.addons.current.message.readonly,
https://www.googleapis.com/auth/script.locale, https://www.googleapis.com/auth/spreadsheets.readonly,
https://www.googleapis.com/auth/gmail.addons.current.action.compose,
https://www.googleapis.com/auth/calendar.addons.execute,
https://www.googleapis.com/auth/drive.addons.metadata.readonly,
https://www.googleapis.com/auth/calendar.readonly,
https://www.googleapis.com/auth/gmail.addons.execute], invalid=
[https://www.googleapis.com/auth/spreadsheets.addons.execute]}
My question is do I need this https://www.googleapis.com/auth/spreadsheets.addons.execute for sheets to see the homepage triggers in my manifest? If not what am I overlooking?
UPDATE
We now have support for Workspace Add-ons in Google Sheets, Google Docs and Google Slides (though it may not be available in all regions as yet)...Google Forms is not yet supported.
What you want to do is not possible as you can only create Editor Add-ons for Google Sheets not GSuite Add-ons.
There are distinct differences between the two.
GSuite Add-ons are currently only applicable to:
Gmail
Google Drive
Google Calendar
Editor Add-ons are currently only applicable to:
Google Sheets
Google Forms
Google Docs
Google Slides
See add-on types documentation for clarification.
Actually you're experiencing this issue because the feature hasn't rolled out yet to your account.
It appears this is a Google Workspace account so you need to navigate to https://admin.google.com/ac/accountsettings/preferences
And select "New Feature"
Then you must select "Rapid Release" and the new Google Workspace add-on feature will be enabled for you probably within 15 minutes but it can take up to 24 hours.
I was experiencing this same issue and once I added this it worked fine.
Also, there isn't an auth scope of https://www.googleapis.com/auth/spreadsheets.addons.execute
You need to simply add https://www.googleapis.com/auth/spreadsheets
and it will work perfectly. Good luck!

Publishing Google Sheets Addon - site verification

I've built a Google Sheets script that queries my company's API and outputs the data from my platform into a spreadsheet. It takes the username and password using a form and then runs an API call to output the results to Google Sheets.
When I tried to publish the addon, I received feedback that I needed to comply with Google OAuth verification. To get this verification, I need to prove that the domain is mine; although I have access to GA for our site (which isn't working for the verification), I am not the domain owner. So, I was wondering, is there a way to publish this Google addon for my company account and what are the next steps to complying with Google OAuth?

what is the SLA for Google App script?

I am new to Google App scripts and I have a few questions (I've done the diligent of going thru the FAQs) that I couldn't find answers yet
I read that Google App scripts are hosted in Google Drive. Where does it actually get executed?
are there any SLA or availability figures for the Google App scripts hosting environment?
can I host the Google App scripts (we will mainly use these as Gadgets for Google Site) on other environment? such as App engine?
many thanks
I've never seen anything official that answer these questions. So the following answers are just from my experience of working with Apps Script and as a Top Contributor.
It gets executed on Google servers, under the "script" subdomain at google.com. There's no info regarding the infrastructure.
There's no SLA. AFAIK it is not even covered in Google support for "Google for Work" (new name of Apps for Business)
No, you cannot host it anywhere else. And also not embed it anywhere expect a Google Site.
Preface
First of all, Google Apps Script seems to be separate from Google Sheets/Docs/Forms/Drive as noted in HIPAA Included Functionality:
As of July 21, 2020, The following functionality is Included Functionality under the applicable HIPAA Business Associate Addendum:
Gmail, Calendar, Drive (including Docs, Sheets, Slides, and Forms), Apps Script, Keep, Sites, Jamboard, Hangouts (chat messaging feature only), Google Chat, Google Meet, Google Voice (managed users only), Google Cloud Search, Cloud Identity Management, Google Groups, Google Tasks and Vault (if applicable).
So, in official docs, Google recognises Apps Script as separate service, as seen in Google Workspace HIPAA Included Functionality terms.
Is there SLA for Apps Script
There is Google Workspace Service Level Agreement (SLA, which is a matter of question), where Apps Script is NOT included in covered services.
From Google Workspace Service Level Agreement
Last modified: July 12, 2021:
"Google Workspace Covered Services" means the Gmail, Currents, Google Calendar, Google Cloud Print, Google Cloud Search, Google Docs, Google Sheets, Google Slides, Google Forms, Google Drive, Google Groups for Business, Google Hangouts messaging and video initiation, Google Chat, Google Meet, Google Keep, Google Sites, Google Jamboard, Google Tasks, Google Vault, and Google Voice components of the Service. This does not include the Gmail Labs functionality, and Google Jamboard Hardware components of the Service.
There is also additional Google Apps Script Additional Terms which have no mention of SLA (as of January 2022).
It's not should be considered any kind of legal advice, but looks like there is no explicit Apps Script SLA.

Custom Functions with add-ons?

I've been trying to create a Google Spreadsheet plugin from some existing Google App Scripts that I have, and one important part of this app script is Custom Functions.
Though the documentation for the add-ons doesn't indicate that this is supported, the documentation for Custom Functions does indicate that you can.
https://developers.google.com/apps-script/guides/sheets/functions
Through testing, I have not once been able to get Custom Functions exposed through a add-on. Does anyone know the secret sauce to get this to work?
Answer
According to Eric Koleda in [Code.gs - date_add_and_subtract]( https://github.com/google/google-apps-script-samples/blob/master/date_add_and_subtract/Code.gs) to make available the custom fuctions in an add-on it's required to include at least one add-on menu, but this is not working at this time on testing mode.
NOTE: The originally referred page was removed but the Date add and substract add-on sample code is available at https://github.com/googlesamples/apps-script/tree/master/sheets/dateAddAndSubtract.
The "solution" to test a custom function add-on is to publish the add-on privately so you could avoid the Google review of an untested add-on. Related Q&A: Publish an add-on privately
NOTES:
You have to create a Google Cloud Project, set OAuth Consent Screen, add the Google Workspaces Marketplace SDK, complete the configuration page, the listing page and to publish the add-on
Setting the OAuth Consent Screen for Internal Use requires to a Google Workspace Account
Setting the OAuth Consent Screen for External Use limited to test account only doesn't allow to publish the add-on to the GW Marketplace.
One scenario is to use different Google Cloud Projects for testing and production but use the same Google Apps Script project. Another scenario is to have two different Google Apps Script projects each one with their own Google Apps Project and someway copy the code from one to the other i.e. using Google Apps Script GitHub Assistant Chrome Extension, CLASP or the Google Apps Script API.
Remarks
There are a couple of related GAS issues, please star them:
"Test as add-on" from standalone project to Google Sheets doesn't link custom functions
After activating an add-on, custom functions get stuck Loading... until spreadsheet refresh

How to add a Google Apps Script web app as a client in Google API console

I have an app that consists of two parts
an installed application (more specifically: a browser add-on) that runs on the user's machine, and
a web app implemented as a stand-alone Google Apps Script app using HtmlService.
The two parts talk to each other and both access some Google APIs on behalf of the user via Oauth. To do this, I set up an API project in the Google API console. In the section "API Access", I created a client of type "Installed Application" for the browser add-on. For the Apps Script part, Google takes care of the authorization flow automatically.
My problem is that Google does not know that these two clients are part of the same project. Therefore, the user has to go through two authorization steps in a row when executing my app for the first time (first, the Oauth process for the browser add-on and then the automatically generated authorization process from Google Apps Script). This is very confusing to the user, especially, since the splitting between the browser add-on and the web app is rather an implementational detail about which the user shouldn't really have to bother.
Is there a way to unify the two authorization flows? I know that one can add several distinct clients to a single project in the Google API console. It seems to me like this feature is explicitly intended for scenarios similar to mine, where more than one application make up what is perceived as a single service by the user. Unfortunately, web apps that are implemented in Google Apps script don't seem to be compatible with the Google API console because of the way Apps Script generates the authorization flow automatically. Or am I missing an option in the API console or in the Apps Script editor?
For future reference: I found out that Google automatically creates an API project in the Google API console for each Google Apps Script project. This seems to be a fairly recent feature. One difficulty for me was that these API projects don't show up when one goes to the API console, clicks on the name of whatever project is currently opened in the upper left corner and chooses "open". Apparently, the only way to reach the auto-generated API project is as follows:
Go to drive.google.com and open the Google Apps Script project.
Chose "Resources --> Use Google APIs...".
In the popup, click the link to the Google API console.
In principle, this should allow to add additional clients to the project, as long as none of the other clients is also a Google Apps Script project. I haven't been able to test this since it still doesn't solve my specific problem: Sending e-mails from the user's Gmail account seems to be a feature unique to Google Apps Script and I couldn't find an Oauth2 scope for this operation. Therefore, I still cannot ask for all required permissions in a single authorization flow. But if anyone who's reading this has a similar problem with different Oauth2 scopes, the above instructions should fix it for you.
Anyway, I solved my problem in the meantime by no longer using Google Drive to upload files.