Automatize Google Drive API connection with Mule 4 - google-drive-api

I'm using Mule 4 and I want to do automatic application which gets data from google drive server when an HTTP request arrives.
I'm having trouble when I'm trying to connect to Google Drive API automatically when a requests arrives, is there some way to authenticate just 1 time to access to Google Drive API, and then, got a persistent OAuth 2.0 code which allows you to connect for life with it? Otherwise, any URL to get a code with no interaction once HTTP request arrives?

You can use the Mule Google Drive Connector to automate the operations.

Related

How to integrate MQTT and Apps Script?

I've got a device that communicate via MQTT.
My device have a MQTT server:
Host: node02.myqtthub.com:1883
Client ID: name****
user: *****
pass: ****
Subscribe Topic: GETTO/304470****tx
Publish Topic: GETTO/304470****rx
For example with MQTTBox software in Windows if I Publish Payload "$ST" it return: "$SA,277,1,1,105,280,0,0,0000,000,180,05.2,2".
I want to have this line "$SA,277,1,1,105,280,0,0,0000,000,180,05.2,2" on my Google Sheet's cell.
Is possible to integrate it with App Script?
Is possible to integrate it with App Script?
Yes it is possible, but it will depend on whether your MQTT broker (which you've shown as myqtthub.com) allows you to create a webhook, which will be needed to forward your messages when received (usually as JSON payload) to the Google Apps Script server via http(s) using your custom Apps Script URL.
Here is an online example: https://docs.emqx.com/en/cloud/latest/rule_engine/rule_engine_web_hook.html

Do I have to call Firebase Remote Config API from the Cloud Function?

I have some params in Remote Config that I want to update from the Google Cloud Functions.
Should I use the Remote Config API when both Cloud Functions and Remote Config belong to the same account or project?
I am asking because Cloud Functions can directly import the data from Firestore without any authentication and API.
Remote Config provided the RESTful APIs to update the parameters or template.
You don't have to call them from a Google Cloud function. But calling them from a Google Cloud function or even Firebase Cloud function is definitely workable.
You can even call the RESTful APIs from postman or some other tools once you set up the call properly.
Check more details here: https://firebase.google.com/docs/reference/remote-config/rest
With Remote Config backend APIs, you could use Remote Config with Cloud Functions for Firebase, changing values in your app based on events that happen server-side. For example, you can use Remote Config to promote a new feature in your app, and then turn off that promotion automatically once you detect enough people have interacted with the new feature.
Using the Remote Config REST API or the Admin SDKs described in this guide, you can bypass managing the template in the Firebase console to directly integrate Remote Config changes into your own processes.
As described here, Cloud Functions can be triggered in response to changes in Firebase Remote Config in the same Cloud project as the function. This makes it possible to change the behavior and appearance of your app without publishing an app update.

How to protect the Backend API against calls other than Azure API Management

I have an ASP.NET Core REST API Service hosted on an Azure Web App. I own its source code and I can change it if required.
I am planning to publish REST API Service with Azure API Management.
I am adding Azure AD authentication to the Azure API Management front. So, the API management front is secured. All the steps are is described here.
All good so far. Here is the question (or challange?) :
Considering that my backend REST API Service is hosted on Azure and publicly accessible, how do I protect it against the request calls other than the API Management Calls?
How the backend service knows the identity and AAD group claims of the incoming call and access to its claims?
A link to a code sample or online documentation would be a great help.
Update
While there are some overlaps with the follwoing question:
How to prevent direct access to API hosted in Azure app service
... part of this question is still outstanding:
How the backend service knows the identity and AAD group claims of the incoming call and access to its claims?
You can enable static IP restriction on your WebApp to only allow incoming traffic from the VIP of your APIM Service facing ( keep in mind in some specific scenarios , the VIP may change and will be required to update the whitelist again).
Clients ==> AAD==> VIP APIM Service <==> (VIP APIM allowed) Web App
https://learn.microsoft.com/en-us/azure/app-service/app-service-ip-restrictions

Google App maker API

I have a requirement to pull and post data to another application. App maker provides URL fetch option to get data from public API's.
I want to access data from a application in my intranet server does app maker provides any option to connect to the outside server.
URL Fetch option is used to consume data, if I need to pass some data is there any option available to do this in app script
I have a requirement to pull and post data to another application
If you don't have strong requirements on a way how to pull/post the data you can consider sharing data via database:
Option one: shared database
You can connect App Maker and your other apps to the same Google Cloud SQL database
Option two: direct database connection
Let's say, you have App Maker app connected to Google Cloud SQL database and some internal apps connected to your internal databases. From App Maker side you can connect to your internal databases using JDBC service and you can whitelist your internal apps to connect to your Cloud SQL instance that App Maker app is connected to.
Option three: API way
At this time App Maker app cannot serve as API endpoint(How to create a rest api in app maker?)
But in theory it should work fine with third party services(External API)

Using Google Compute API automated over as server

I'm using the Google client API library for Python. My code is running on an Ubuntu 14.04LTS server.
I have a working Google Compute project, were I created and downloaded a OAuth2.0 token to my server.
I'm trying to write a script that does the following:
Automatically (with no user interaction) authenticate to Google Compute engine.
create a new VM and then perform more actions...
My basic problem is using the OAuth2.0 authentication. It required user approval on a javascript supporting browser, and I want to do it automatically, on my server.
Using my code on my desktop works. A browser page pops up requiring my approval. On my server, I get the following message:
we have detected that your javascript is disabled in your browser
The code segment I use for authentication is:
# authenticate using the OAuth token
client_secret = os.path.join(
os.path.dirname(__file__),
self._oauth_token_path)
# set up a Flow object for the authentication
flow = client.flow_from_clientsecrets(
client_secret,
scope=scope,
message=tools.message_if_missing(client_secret))
# open credential storage path
credential_storage = file.Storage(self._credential_storage_path)
credentials = credential_storage.get()
# get credentails if necessary
if credentials is None or credentials.invalid:
credentials = tools.run_flow(flow, credential_storage, flags)
I read about service account access as a replacement of the regular OAuth2.0 authentication. Does any one know if that's the best way to go? any thoughts on how to do it better?
OAuth 2.0 requires user approval and is not the method to go for if you want to run your code/scripts automatically.
Service accounts are more suitable for this and are supported by the API (https://cloud.google.com/compute/docs/authentication#tools)
You create a service account + key in the developer console and use both to authenticate your application.