Callback URL in Google App Maker - 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();

Related

Firebase Web Debug Token different each time for App Check

I can't make my app work in local host with App Check. Each time the generated debug token is different so I can't add it in the console. The only way I made it work is to add programmatically to index.html the custom debug token I generated like this:
self.FIREBASE_APPCHECK_DEBUG_TOKEN = '186152BD-4BAA-blabla';
is there a way to do this only for development environment? I know we can get the environment from Flutter inside flutter from String.getFromEnrironment but I don't know how I would do this with plain javascript before the app loads?
I read that adding localhost to the recaptcha key is a security breach so I didn't want to go that route.

Workaround for web-view blocking google authentication within a web application

Good Morning,
So I am facing a dilemma using Firebase Auth (specifically Google OAuth).
Google seems to have blocked the use of their OAuth when a user access my site via a web-view (for example they have clicked on the link in TikTok and the website has opened within a view in TikTok)
It makes sense as to why Google has blocked this, however, this is now stopping my ads from being successful as users see the ad, click on the link, and then it opens up in the TikTok web view, and then they can't log into my web application.
I'm using the simple Firebase Authentication plugin, with Nuxt/Firebase the code for it is as below:
const provider = new this.$fireModule.auth.GoogleAuthProvider()
provider.setCustomParameters({
prompt: 'select_account'
})
this.$fire.auth.signInWithPopup(provider)
Does anyone know any workaround? I've googled this so much but the only real solution I have come across is if I'm creating an android/ios app and this is not a mobile application, this is just a web application.
Thanks so much for your help.

Firebase OAuth's callback URL does not include the project ID

I want to use Twitter authentication with Firebase Auth.
As usual I created a project in the firebase console and added a web app, but the project ID is not included in the callback URL, and cannot work with twitter app.
How can fix this?
Thank you for hearing my poor English.
empty callback url
process which caused the problem

Google Admin Directory API in Appmaker

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();

Listing my youtube videos in web application

I can get my list of youtube videos using google .NET client libraries following the example in the following link
https://developers.google.com/youtube/v3/code_samples/dotnet
This works fine when I am using it in a console application and my project's Client Id is of type 'Installed Application'.
I want to make it work for my web application. I created a client id of type 'Web Application' and provided appropriate redirect_uri. When I run the application, it always generates a random redirect_uri in the request and I am getting redirect_uri mismatch error. How can I fix this problem? What am I missing?
Did you follow the instructions on https://developers.google.com/api-client-library/dotnet/guide/aaa_oauth#web_applications?
It contains code snippets and explanations about the 'redirect URI' you need to register in Google Developers Console (The URI should look like: your_site/AuthCallback/IndexAsync).
If you choose to create a ASP.NET (NOT MVC) application, you can take a look in the following sample: https://code.google.com/p/google-api-dotnet-client/source/browse?repo=samples#hg%2FTasks.ASP.NET.SimpleOAuth2.

Resources