Design approach when using Firebase as backend for Mobile and Web Apps

721 views
Skip to first unread message

Ven

unread,
Feb 9, 2016, 6:03:42 PM2/9/16
to Firebase Google Group
Hi,

We are developing Web and Mobile apps with Firebase as backend and Braintree for payments.
Below are the approaches we thought of. Could anyone advise what is the right way or what corrections we should make in case we are wrong.

for Ionic Mobile App:

Approach 1:
 1. Login using Firebase authentication.
 2. For processing Braintree payments from Ionic app, post to NodeJS server using REST.
 3. Using ExpressJS, verify whether the user is authenticated in Firebase and process the payments.

Approach 2:
 1. Login using Firebase authentication.
 2. For processing Braintree payments from Ionic app, post to Firebase Queue.
 3. Use ExpressJS to monitor Firebase Queue and process the payments.


for Web Application(Angular):

Approach 1:
 1. Login using Firebase authentication.
 2. For processing Braintree payments from Ionic app, post to NodeJS server using REST.
 3. Using ExpressJS, verify whether the user is authenticated in Firebase and process the payments.



Tom Larkworthy

unread,
Feb 9, 2016, 7:41:49 PM2/9/16
to Firebase Google Group
So trying to check the user is authenticated outside Firebase seperately is possible, but easy to make a mistake. You would need to transmit the JWT and have the Firebase secret passes to the expressJS service. I think including a queue inside your production database is a better path. With the queue and security rules, you can trust that only authenticated users can write to the queue, and have an implicit level of trust in the data within it. So that would be my preferred path.

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/138b2c30-4046-4057-b6b1-c04d40686168%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ven

unread,
Feb 9, 2016, 8:12:50 PM2/9/16
to Firebase Google Group
Tom,

That throws me 2 questions.

1. If we transmit the JWT, can we use any generic JWT library like https://github.com/hokaccha/node-jwt-simple and decode it and check the Expiration times. Is it fine?

2. Is it advisable to use the queue for storing Credit Card data? Would we not be compromising on SAQ-A?

Thanks
Ven

Tom Larkworthy

unread,
Feb 9, 2016, 8:22:24 PM2/9/16
to Firebase Google Group
1. yes, have a look at the first answer here http://stackoverflow.com/questions/18863819/verify-clients-firebase-token-at-node-js-server

2. That's beyond my knowledge. There is a bit of a thread here on the topic https://groups.google.com/forum/#!topic/firebase-talk/sg-WCHVXs5k If that's a blocker then by elimination you know which route to choose!

Tom

 

Tom Larkworthy

unread,
Feb 9, 2016, 8:34:48 PM2/9/16
to Firebase Google Group
So I did not really appreciate the CC information was the relevant question initially. Payment providers like stripe can do a dance without Firebase handling the actual number. I am not sure about Braintree, is this approach relevant? http://stackoverflow.com/questions/22879095/firebase-payment-gateways 

Ven

unread,
Feb 10, 2016, 5:49:06 PM2/10/16
to Firebase Google Group
Thank you Tom. That clears the air.
We will go with NodeJS.

Ven
Reply all
Reply to author
Forward
0 new messages