Search code examples
firebasegoogle-cloud-platformweb-applicationsfirebase-authenticationgoogle-cloud-sql

Is possible use Firebase Authentication on Client Side to auth access on Google Cloud SQL?


I'm starting work with Web Applications and I build a VueJS app. So far I'm using the Firebase Authentication to auth the users and access the Firestore. I going to update my service to use Google Cloud SQL as database, but how I've only Client-Side application I don't know how the Cloud SQL access is authenticate. Yes, I'm trying saving money don't using VMs as Backend like EC2 or App Engine. So, I believe that the directly question is: there are a securely and good practical way to access Cloud SQL from Client-Side application?


Solution

  • There is no way to access Cloud SQL with a Firebase-minted ID token.

    Google Cloud SQL, and most other Google Cloud products that are not part of Firebase, take an OAuth2 token to identify the Google account used to access the service. They typically come only with SDKs for server-side access where this is not so much of an issue.

    Firebase on the other hand uses a JWT to identify the user, who can be signed in with a Google account, but also with many other providers.