23

Using Firebase stack for chrome extensions :) However, have one BIG problem.

Users located in China cant use the app since Google is blocked there thus Firebase authentication fails ... well, one option is to use VPN but in terms of user experience, it's a big No No ... is there any better way to resolve/workaround this issue

Using mainly firebase auth (Google provider) and Firestore

Can use somehow custom tokens to resolve this? https://firebase.google.com/docs/auth/admin/create-custom-tokens

Or external authentication service combined with firebase, in this case, need to have authenticated access to firestore as well

alexpov
  • 1,158
  • 2
  • 16
  • 29

2 Answers2

8

Create an API on HEROKU. Make all your Oauth and every call made for firebase go through the API. This API will only bridge all information between CHINA and GoogleServices (Firebase) since the great firewall blocks them.

Christophe Chenel
  • 1,802
  • 2
  • 15
  • 46
  • I suggest heroku.. But you can also use other hosting service.. Always make sure they pass the great firewall. There is some service to verify that : https://en.greatfire.org/analyzer – Christophe Chenel Oct 22 '18 at 15:15
  • Azure too is able to go through the greatfirewall. – Christophe Chenel Oct 22 '18 at 15:53
  • thanks, yep, that what I eventually found myself doing – alexpov Nov 22 '18 at 06:59
  • @alexpov how did you manage to reroute your frontend code? Did you have to rewrite firebase js library yourself? I can't seem to find a reasonable way for this :/ – eddyP23 Apr 17 '19 at 13:05
  • @eddyP23 I haven't tried yet, but what I'm thinking is: Use "AWS API Gateway" or "Google Endpoint" to reroute API request to "AWS Lamba" or "Cloud Function" which runs Nodejs when evoked. Then use "Firebase Admin SDK" to write code in Nodejs. – user2875289 Jul 29 '19 at 13:05
  • @eddyP23 You don't "reroute your frontend code", you "reroute your frontend request" – user2875289 Jul 29 '19 at 13:09
  • @ChristopheChenel I've never used Heroku before and this is the only thing I've been able to find regarding creating an API on Heroku, is this what you're referring to? https://devcenter.heroku.com/articles/mean-apps-restful-api – Nahele Allan-Moon Aug 14 '19 at 08:16
  • 1
    @NaheleAllan-Moon yes this is it. – Christophe Chenel Aug 14 '19 at 16:54
  • @ChristopheChenel how do you implement this? – Casper Lindberg Feb 05 '20 at 01:05
  • @ChristopheChenel this seems all viable for rest api calls. But what if you want for instance to listen on a document collection in Firestore? Another interesting case is Google Deep Links. Any ideas / comments on that? – Daniel Jun 26 '20 at 14:33
  • @Daniel Maybe you could make your WebApp from heroku to manage all communication with a websocket and bridge the observable from client to firebase and vice-versa. I found this question that looks like what you ask : https://stackoverflow.com/questions/48734290/javascript-websocket-into-firebase Also, I don't know what are the intents for the Google Deep Links, is it an integration of google ads ? If so, I don't think you should put google ads for an app dedicated for Chinese customer. The company "Baidu" should be better for this case. – Christophe Chenel Jun 26 '20 at 14:42
  • 1
    @ChristopheChenel Thanks a lot for the tip. Highly appreciate. Deep links are a unification of universal link for iOS and Android app links to get the same behaviour on both platforms. Essentially Google hosts a mini website to do the proper forwarding. They are great for app referrals but if the app cannot be placed into the Chinese App store it would only work for the Android version. – Daniel Jun 26 '20 at 14:48
  • 1
    This https://stackoverflow.com/questions/42605566/can-firebase-be-used-as-a-database-in-china-now relevant information on the topic discussed here. – Daniel Jun 26 '20 at 14:52
1

The simplest solution may be to set up a proxy server to forward your apps requests to Firebase.

nloewen
  • 1,279
  • 11
  • 18