Pregunta

I have been testing webhooks from http://context.io/ with Firebase. Which will fire off a POST whenever a valid email is sent.

The issue is that a couple of the keys have a '.' in the name. Which has Firebase sending me a 400 error:

"error" : "Invalid data; couldn't parse JSON object, array, or value. Perhaps you're using invalid characters in your key names."

Can I use security rules to manipulate the newData to replace the '.' or do i need to a use a proxy server in-between.

If so, what is the recommended approach for a thin nodejs proxy server, only made to do this.

¿Fue útil?

Solución

Security rules only enforce security and cannot be used as translators or filters. Thus, you'll have to manipulate the keys before sending them to Firebase.

It doesn't look like you are forced to use the email as the key, since you can structure the URL to which context.io sends your requests. Could you save the effort of a proxy by using the context.io unique ids or some other unique id instead of email address?

Otros consejos

If you REALLY want to work with the email as the key, you can still do it using a base64 encoded value of the email address.

This has many benefits including sorting integrity as well as faster lookups if you're constantly searching by email and accessing data within that.

Ref:

Python: https://docs.python.org/3/library/base64.html

Javascript: http://www.w3schools.com/jsref/met_win_atob.asp

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top