How to Integrate Google Cloud Services With Flutter? - flutter

I have been wondering if it is possible to integrate Google Cloud Services such as Cloud Text-to-Speech in Flutter. The lack of documentation makes me wonder if there's some workaround or something because I can't find a way to integrate.
As you can see in the documentation, there are only samples for different languages, no presence for Flutter:
https://cloud.google.com/text-to-speech/docs/samples/tts-synthesize-text
enter image description here
Any suggestions? Will appreciate it.

GCP TtS is available also by REST API calls, as any other GCP service. So you can write Dartcode to perform an HTTP POST request to send text or audio.
BTW you have to consider how to authenticate to TtS, and there are different options, some of them:
your users need to be authenticated in your GCP organization by your mobile app, and they also need to have the permissions to invoke that service. Then your app can invoke TtS using HTTP POST and impersonating the user.
your mobile app authenticate the users without a GCP or Firebase identity. In that case you need a backend layer (might be a REST service or a simple Cloud function) acting as a proxy between your mobile app and TtS. Your app calls your backend, the backend authenticates to TtS using a service account (GPC identity), then the backend invokes TtS and sends back the result to your mobile app.

Related

Securing google firebase cloud function with stripe integration

We are using google cloud platform to host our stripe payment gateway. The cloud function sends the payment intent to stripe and a callback that stripe calls with a session object.
Inside the google cloud platform, we are not sure what permission to set our cloud function. Right now, we allow all public access and we are fearing that a hacker can see our secret key from our index.js (where the cloud functions live), or has the ability to manipulated the code inside of the index.js.
With the function's purpose described above, what is the safest permission setting that does not allow any public users to read or manipulate our functions? All we want is to allow the users to invoke the function,
thank you
I've implemented Stripe for an app using a combination of the Golang SDK and JavaScript SDKs that I'm deploying as an app to Cloud Run. So my config is slightly different to yours.
You should be able to:
Provide some protection by keeping Stripe's API keys as environment variables so that the JavsScript only accesses these in-memory. You may want to consider using Secret Manager.
Differentiate between authenticated handlers that trigger the flow and restricted handlers that accept the callback from Stripe.
You can authenticate using Cloud IAP (Google auth requiring users be part of the project) or e.g. Cloud Endpoints and Firebase auth
You can restrict access to the callback to Stripe's endpoints
I'm not a security guy.
Your learnings would make an interesting customer story for Stripe and GCP.
check how these guys implement their stripe functions, they have a bunch of them https://functions.store

Can IBM Watson Assistant use more than one webhook

I am making a chat bot that requires the use of 3 external APIs to be used as responses. When wanting to call an external API from within Watson Assistant, webhooks would be required to connect to one API either locally or on the cloud (IBM functions). How would I connect more than one API to the assistant if possible ?
Unfortunately no, not at this time. The design was meant to have a middleware app that orchestrated the apis, formats the data, etc just like the video in the docs.

Why do I need to use admin SDK with Cloud Functions to send notifications to other device using FCM in Flutter?

Im new to Flutter.
I wondered why I need to use Cloud Functions to send notifications to the other device in Flutter.
If one device simply know the token of the partner device, I think that it can specify the token and send a notification directly from the client side.
Does this question relate to this answer?
How to send push Notification using FCM and Flutter(One to Another Device)?
Thank you.
You certainly could send the message directly from your client app, but you would then have a huge security problem. The Admin SDK requires a service account to initialize, and you would have to package that service account in your app so it could call the FCM API.
Distributing your service account is strongly discouraged, as it now allows everyone to do everything to your project that the service account is allowed to do. This could be anything and everything.
Instead, people put messaging code on secure backends where the service account can't be seen by others. Cloud Functions is a popular option for this, but you can use whatever backend you want.

How to integrate IBM Cloud Functions with App ID for authentication?

I have seen the tutorial for starting the cloud functions and creating a guestbook on IBM Cloud, but when trying to connect an App ID it actually requires an application and not a Cloud Functions API.
So how can I connect them? Is there some tutorial somewhere? What needs to be considered?
depending on what you want to do, take a look in https://console.bluemix.net/docs/services/appid/relatedlinks.html#secure.
Specifically one of
Securing your Cloud Functions API
Securing your serverless Cloud Functions mobile backend with App ID
Tutorial: GitHub traffic analytics with Cloud Functions and Cloud Foundry
Cloud Functions supports OAuth 2.0 user authorization out of the box and you can bound your App ID instance directly to it.
Here's a fairly recent tutorial showing the steps:
https://www.ibm.com/cloud/blog/authenticating-users-with-cloud-functions-api-gateway-and-app-id
If you're looking to automatically initiate a new authentication flow as in redirect to the an identity provider where you're user will sign in, you'll have to either add logic to your application using an OIDC SDK (For instance App ID's: https://github.com/ibm-cloud-security/appid-serversdk-nodejs/) or add it manually handle the flow from a set of actions.
If you go the action approach, you'll have to keep in mind that they are ephemeral and can't keep session state, so you'll have to keep secure cookies in the user's browser.

Can Google Prediction API be used to develop Predictive Chat Bot?

I was just fiddling around different machine learning platforms and was planing to use Google predictive API for creating predictive chat bot.
The issue that I am facing now is each request to the API requires OAuth authentication. The fact that I will not be able to authenticate requests for processing the text entered by a client is the real concern. How will I probably respond to a text entered in the chat by a guest user in real time? Is it possible or is Google predictive API not made for this use case?
I am following Prediction API Quick Start Guide by Google and using POST MAN for making API calls.
If possible, please guide me using references or code snippet.
You can create service accounts in place of OAuth authentication tokens. You can create these through the Google Cloud Console. It will then give you the ability to create a server to server (Google) auth that you can use to interact with the API.