Google Admin Directory API in Appmaker - google-app-maker

After creating a directory datasource the Google Admin Directory API is automatically added to app settings. However the AdminDirectory object is not usable in server side appscript. Documentation for adding the AdminDirectory object to appscript in other apps suggests the api needs to be activated via the api console. There are unfortunately no links to the project at the console from the advanced section of the app settings. The user I am using developing this app with has MANY projects in the console any of which could be one created by appmaker. Is there a way to determine which project is the one the appmaker app is associated with? Is this even what I need to do to make the AdminDirectory object available in server side scripts?

I run some tests and you should be able to use the AdminDirectory object after adding a Directory Datasource to your App Maker application.
To test this I created a new app in App Maker and added a Directory Datasource. Then I created a Server script and used the code available in this Apps Script Admin Directory example https://developers.google.com/apps-script/advanced/admin-sdk-directory#list_all_users (*Note that for testing purposes, I used console.log instead of Logger.log)
Then in a new Page I added a Button widget and called the server script by using google.script.run in an onClick event in the Property Editor and I was able to get (console.log) the list of all users in my domain. Note that in order to call a server script, you will need to use google.script.run as explained here https://developers.google.com/appmaker/scripting/client#call_a_server_script

Try in AM editor App Settings -> Deployments, then expand deployment you need. There you will see 'View Logs' button. Clicking the button will open Google Cloud Console for your project.
By the way, you can access directory model by querying it:
var people = app.models.YourDirectoryModelName.newQuery().run();

Related

Callback URL in Google App Maker

I'm building an App Maker app that uses the Google OAuth2 library (https://github.com/googlesamples/apps-script-oauth2) to connect to an external service.
All is working fine until it comes to setting a callback URL. I've implemented the same type of project for a Google Sheets addon, but using apps script there I can get the script URL, but I can't seem to access that with App Maker, making it tricky to register the callback URL in the API I'm accessing.
Has anyone found a solution to this?
Thanks,
Paul
I know at least two ways how you can get callback URL:
Copy it from your deployment
Get it in runtime:
// server script
var url = ScriptApp.getService().getUrl();

After publishing an app, how do you find the public URL to give to your end users?

I have published my app in Google App Maker, however when I share the normal "share" link it gives end users the ability to edit the app instead of using the app.
Where do I find the public version of the app I just published?
Go to Settings
Select Deployments tab
Click or copy deployment link
Note: The URL is not really public. You can share the app only within your domain at your best.

Azure Active Directory passing empty GUID for tenantId with default template

I've tried this with several MS accounts that have Azure/AAD accounts in place and have attempted using both Visual Studio 2015 as well as 2017 and am getting the exact same bug/error.
Using the default ASP.NET MVC template with AAD integration out of the box (no code changes at all). The App is registered in my AAD account, and I see the tenantId and other GUIDs are in the Web.Config as they should be. I also traced the call stack as far as I could and the tenantId is initialized properly yet I still get this error:
Requested tenant identifier '00000000-0000-0000-0000-000000000000' is not valid. Tenant identifiers may not be an empty GUID.
This happens after the permissions acceptance screen.
Here is a screenshot as well:
As requested, here is the Web.Config:
So the resolution was very simple. But this is not documented anywhere, not even in Vittorio Bertocci's book on the subject - which leads you to believe that you can log in as the Azure subscription owner after creating the Visual Studio project without any additional setup in Azure.
Since the new portal is in preview the UX is not really all that obvious. Here are the steps to take after creating a new ASP.NET project with Active Directory integration:
You have to log into Azure (in the new portal)
Click on Active Directory.
Go to your "App Registrations"
You will see your new application there. click on it.
Inside of the "Essentials" panel at the top of the app registration blade you will see a link with the header "Managed application in local directory" and the link will have the same name as the blade you are already in (This is the confusing part). Click on that link...
You are now one blade deeper and are able to see how many users this application has. It will likely be 0. - This is the issue!
Click on "Users and Groups" in the menu on the left side and you can start adding users.
Please note that the above steps may change as AAD comes out of preview in the new portal.

Google Developers Console: how do I register a new application?

I'm trying to follow this tutorial for Google's Analytics API.
The tutorial says "If you haven't already registered your application with the Google Developers Console, then set up a project and application in the Developers Console".
The documentation for the Developers Console says "A project consists of a set of applications...", which makes sense.
I'm able to create the project, but I don't see any way to create an application within that project. Both pieces of documentation linked above instruct me to click on "Registered apps" in the left sidebar, but there is no such link. (I believe these docs were written for an older version of the Console.)
On the recommendation of another poster, I tried using the old Console instead, but I can't find any "Registered apps" link (or any other way to create an application) in that version, either.
Any ideas?
You didn't say whether you were doing this as a service account, web app, or installed app but this should get you pointed in the right direction for all of those.
And, Google radically changed the console UI.
The application gets created when you create the credentials for an application type.
If you created the project in the Google Console, select the project and follow the instructions in the tut you linked to:
Go to the Google Developers Console.
Select a project.
In the sidebar on the left, select APIs & auth. In the displayed list of APIs, make sure all the APIs you are using show a status of ON.
In the sidebar on the left, select Credentials.
Add this step: Click on the "Create New Client ID" button then select the application type.
In either case, you end up on the application's credentials page.
To find your application's client ID and client secret, and set a redirect URI, expand the OAuth 2.0 Client ID section.
Write down the values for each of these fields:
Client ID
Client secret

How does Woobox create facebook apps automatically?

It is said you cannot create apps automatically with the current facebook API.
Create and Configure Facebook Apps via API
How to programatically create a Facebook application via JS SDK or Open Graph API? (createApplication)
Yet woobox.com does it.
I have created a few photo contests in their portal. It didn't ask for extra permission. No dialogs showed up. I just got these links:
http://www.facebook.com/pages/-/105892812908965?sk=app_422118604517529&app_data=dlt-1
http://www.facebook.com/pages/-/105892812908965?sk=app_451684954848385&app_data=dlt-1
How did they create these apps?
app_422118604517529
app_451684954848385
I would expect
www.facebook.com/pages/-/105892812908965?sk=app_SAME_APP_ID&app_data=WOOBOX_ID_1
www.facebook.com/pages/-/105892812908965?sk=app_SAME_APP_ID&app_data=WOOBOX_ID_2
You are correct with the presumptions that Facebook apps/users/groups and pages can't be created dynamically. What woo box is what many other page tab applications are doing. They create a number of applications for different templates and then customize them according to your inputs. They don't create apps dynamically. And these dynamic apps get their required data from app_data field.
Another point to note is
An app can't be installed on a page twice
that is why many Service provider that provide page tab applications maintain a pool of applications to fulfill their user's desires.

Resources