Can firebase be used as a database in China now

Solution 1:

* EDIT 24 January 2020 *

Some of the information here might be out of date. Firebase has a China service at https://firebase.google.cn/ which is not blocked in the PRC. (Thanks to @c-an for bringing this up.) That said, *.google.com and *.googleapis.com are still blocked in China. I'll change/update this as I get more information.

Original Answer

For now Firebase is blocked and can't be used in China, along with other Google services, because the PRC has blocked all URIs with *.google.com and *.googleapis.com.

This also means, for example, that the Play app store can't be accessed from China. If you don't know what's going on between Google and the PRC, here's a primer.

Also, according to Chinese law, user data of Chinese citizens must be stored inside of the PRC. You might be able to get away with only addressing this once you have a significant number of users, but the trend has been for the CCP to crack down more and more on foreign information, even busting VPNs and declaring them illegal despite complaints of academics who say that they need, you know, real information.

As we're now in the run-up to the 19th Party Congress this autumn, we can expect the situation to get worse before it gets better. Maybe 2018 will leave room for relaxation?

For now, very sadly, forget anything Google in China, and be prepared to store user data of PRC citizens on servers located inside the Great Firewall. Also be prepared for seemingly random degradations of your service within China, or to be blocked altogether, along with these other blocked services.

Update 2017-11-23: The 19th Party Congress has come and gone and, if anything, Google services look less likely than ever to become available in China. The great firewall is likely to continue to be strengthened as the Chinese Communist Party extends its role into corporations, and foreign firms are generally disadvantaged.

Update 2018-08-05: Google plans to open a censored version of its search in China, according to leaked documents. It seems reasonable to assume that if a censored Google Search becomes available in the PRC, then Firebase and other Google Cloud products may as well. The censored search plan, code-named Dragonfly, has reportedly been in the works since December 2017, possibly a result of meetings that month between Google CEO Sundar Pichai and an unnamed top Chinese official when they met at the World Internet Conference in Wuzhen, China, where PRC General Secretary and President Xi Jinping gave a speech.

Update 2018-12-23: It appears that Google's Project Dragonfly is now on hold if not outright abandoned. This implies that the outlook for Firebase in China has worsened.

Solution 2:

You can build your own Rest API server outside of China, and make the server talks to Firebase rest api endpoints of Realtime db or Authentication, https://firebase.google.com/docs/reference/rest/database. So you web app talks to your rest api server (accessible from China), and your rest api server talks to Firebase.

Solution 3:

The answer is NO : Using a huge part of Firebase services, I contacted the support, this is the answer :

I'm glad you are considering Firebase for your project. However, in accordance with current U.S. policies, it is not possible to use Firebase from within certain countries. For more information about these restrictions, please refer to the U.S. Department of the Treasury website. The current list is of blocked countries is listed here. If you have end-users located within China, it's quite difficult to access Firebase there since the use of Firebase requires Google Play Services, which most of the devices in China don't have. We understand that access to our products has been problematic from within mainland China. We believe it may have been caused by networking conditions in China, rather than Google's own services. Since access to services is determined by the respective country's government and they don't report to Google, the Transparency Report is the most authoritative it can be.