I still would use a web hook, as the HttpClient does not support https and while there is a https client, it’s kind of hard to use.
In order to change the parameters in a GET request, you use the Query Parameters part of the web hook. The data can either be fixed in the web hook, or parsed from the data sent from the Photon/Electron and caught by the web hook. You can also send multiple values from the Photon/Electron, formatted in JSON, and parse out the individual pieces so you can put them into your GET query parameters or POST data as needed for the service you’re interacting with.
Disclaimer: I have 6 days and counting worth of experience with Particle. However I have 4 years of experience working with Google APIs and Googles Authentication servers. Me
I have been trying over the last few days to get webhooks to send data to Google Analytics which does not require any form of authentication. Current status kind of works. So I do know a little about webhooks and how they work. I am basically replying to this because I can fill in some of the gaps from the FireBase and I am happy to help. As far as i know you cant edit a webhook once its been created the endpoint is going to have to be static
As already stated
HTTPS is required. Firebase only responds to encrypted traffic so that our data remains safe.
Sending data.
I have been scanning the documentation it seams that you can send data to them with out being authenticated. This seams to be wrong in my opinion. You should check up on it i would assume that when you send data to an account they would require that you be authenticated.
Apparently they do allow for authentication. Now for some depressing news it seams their authentication method is JWT this is basically service account authentication. This means your not going to be able to just have a token on your device and request access like you could with normal Oauth2. Your going to have to calculate the JWT (Which I personally have never managed to do with Googles Auth servers with out using their official client libraries) Granted i think Googles Oauth servers are slightly different then Firebases but its probably the same bread of server.
Before you go to deep into this i would find out.
Do you have to be authenticated to send data?
If you have to be authenticated can you create a JWT with your device.
If you don't need to be authenticated then I can probably help you put together the JSon required to send data to the server from the info in the documentation.
Tokens have to be generated when you send them using the Secret. Because it has current time built into the JWT. Can you generate the Token on the device?
I guess i could be miss reading there documentation and they have another form for authentication then JWT. I will have a look around.
BTW I used the HTTP library it was quite easy to set up. If you need to change the endpoint might be best to go with that since you cant edit webhook after it was created.
I wrote a proxy to tackle this problem, since Firebase v3 requires JWT tokens that are difficult to generate properly. This proxy will authenticate your device_id and particle access token (so that it can send back realtime database events, and provide some layer of authentication without you having to do your own device authentication in firebase) and generate a Firebase auth object where the uid matches the device_id, so you can lock down Firebase trees with server rules that match auth.uid. Something like:
would be only readable to your actual device (where the proxy authenticates your particle token and device id before creating the firebase connection), assuming you set the rules to:
It’s alpha until I can test it on a “real world” application. I haven’t tested the webhook example, and I used a mustache template in the URL field which… I guess might be wrong. If that doesn’t work, I’ll rework the proxy for a convenient way to pass the device_id, maybe in the headers.
Hi @anderson916 I am in the same boat as you. We are trying to send event data from Photon board to Google Fire-base Real-time DB. If you find out anymore information on it or have already figured it out please let me know. Maybe if you haven’t found a method yet we can team up.