ESP32 and Firestore/Google Cloud Functions - c

I am trying to get data from Firestore onto my ESP32. I want to do this either directly, or by calling a google cloud function (likely python) which will interface with firestore and return data back to the ESP32 through an HTTP get.
Has anyone done this before? And if so, could they give some guidance on how to do that. I can connect my ESP32 to the internet no problem, and I have done HTTP requests to websites that return quotes and such. However, when I change the url to my cloud function url I cannot trigger my google cloud function.
Any information or resources on this would be greatly appreciated!

if you're working with esp-idf, you don't need a cloud function, you can communicate directly with the Cloud Firestore REST API using this component: https://github.com/kaizoku-oh/firestore

Related

Google cloud endpoints service is not listed in api library

I'm trying to share my API (with a custom domain) with the customer( service consumer role), but this API is not listed in the API library. When he tries to open API using the link to generate API key he gots errors. The same problem I have when I try to generate API key for customers. I'm using endpoints frameworks for the GAE standard environment. Image
This one looks more like a problem with the Cloud console or the Cloud APIs, I'd better address the issue at a Public Issue Tracker (PIT), you can open one in here, and preferably add a relevant HAR file that should contain some additional information of the response message.
This will help to correctly address any ongoing service issue.

Sending an email from contact us form using only Angularjs and Send grid without back end API in place

I have taken a look around the internet and all the solutions emphasize using Express and Node Js API in place to able to send an email. I would love to see any suggestions on how to best go about it because I don't have a backend in place. Thank you.
You're going to need some sort of backend otherwise the API-Key will be exposed.
From the SendGrid documentation:
When you have a browser-only application that reaches out to APIs, the API key has to be embedded in the application. Anyone with access to a browser-only application can access all of the Javascript source code, including your API keys.
Making your API key publicly accessible could result in anyone authenticating API calls with your API key — this is a significant security concern both for you and SendGrid.
You could use a serverless AWS lambda function or google function which would be a "backend" but without having to support the infrastructure / use a big framework.

Incluiding payment systems in a ReactJS/Firebase app

I'm currently developing a ReactJS & Firebase app, but I'm facing the following problem:
As all the code is run in the client side, how can I connect to the payment API without exposing my private token?
I was thinking on creating a Google Cloud Function that could handle this requests. I think this functions should manage maybe a sign in to get the token, and later request the payments. Should this work?
Right now Google Cloud Functions isn't free to make requests out of a Google app. Does someone know how could I avoid the $25/month?
Another alternative I was thinking on was creating a Rails API on Heroku to manage only this requests, but I'm not sure if I'm not exposing the tokens by managing the logic on the front side. (Because the front end would have to talk to Firebase and this new API)
Security is a must.
Thanks!

Is it possible to identify the user inside a gRPC service using Cloud Endpoints?

I am investigating using gRPC with cloud endpoints for a new project in which I will need fine-grained authorization. It's simply not clear to me if I'll have a way to identify an authenticated user after ESP has passed the request onto my gRPC services.
I've been pouring over the documentation available for the cloud endpoints solution trying to find a definitive answer to this question, but This article is the best I could find. It specifies that "Receiving auth results in your API is currently not supported for gRPC services", but I honestly don't know if that means I will not be able to know which user sent the request, or if it means something else.
If you can provide insight, I'd greatly appreciate it!
Thank you for your time.
That article is wrong. I have fired a ticket to fix the document.
Authentication result is passed to gRPC service as gRPC metadata "X-Endpoint-API-UserInfo".
Note gRPC metadata is keyed lowercase, so use 'x-endpoint-api-userinfo'.

Google API discovery possible within Google Apps Script?

I want to access an external Google API through a GAS trigger. Is it possible/advisable to use something like the javascript Google API client library, adapted for the GAS context, instead of manually using URL Fetch, as mentioned here ?
PS. I am trying to hit the Google App Engine TaskQueue service via its REST API.
In the Apps Script Code Editor, under the RESOURCES, ADVANCED GOOGLE SERVICES menu, you can enable different API's. I don't see an Advanced Service for anything the resembles a Task Queue. There is a Tasks API, but that's for Task List, which is very different than the Task Queue.
So, I don't think you have any choice but to use the REST API with UrlFetchApp.fetch() in server side gs code in Apps Script.
As far as the trigger is concerned, you might want to look at quota limits, if you're going to be running it a lot, or running code that takes a long time to run.
You can use external APIs with OAUTH2 as outlined here: apps-script-oauth2
It's just not built-in, but you can easily add it as a library as mentioned in the Readme.

Resources