Getting Google+ Domain API to work in Google Apps Script - 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 =)

Related

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.

How to authenticate deployed Google App Script?

I'm building Google App Script product, when I deployed GAS project, I only want people in my organization can access to the app. It's ok with the browser when user already login with my organization email. But how I can access deployed URL by Postman or Terminal, Do I need access token or anything else?
Any advice is welcome!
Any advice is welcome!
I would like to suggest to use the OAuth PlayGround using the Google Apps Script deployed projects. You can also check this similar SO post for more solutions regarding your issue.

Google Apps Script oAuth 2.0

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.

Is it possible for a domain owner to enable Google Drive API for all users?

I've added a few scripts to a Google Spreadsheet. One uses the Drive API. First time a person runs the script he has to manuallly enable access to Drive API and click on the link to Google Developer Console and enable access to Drive API.
There are about 100 people in my organisation who are going to use this spreadsheet and is there some way for me as a domain owner to enable Drive API so that the users don't have to do it by themselves?
/Magnus
Your users are going to have to create there own application in Google Developers console, and authenticate themselves.
Google Made a change recently that makes it against terms of service for you as a developer to give out your client id from Google developer console. So they will need to make there own. There is also no API that will let you automate this for them either.
As for authenticating that is the nature of authentication. Each user must give the application /or in this case script access to there account.
Sounds like you are doing everything correctly right now. It may seam time consuming but that is the way things have to be done.

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.