简体   繁体   中英

Firebase Authentication mixed with cloud sql

I'm developing my first app with firebase auth and Google App Engine, and I'm wondering how should I do some things.

For example: My architecture will be in Google App engine, and I'm using Cloud SQL to store data (using sequelize). The app is developed with node.js and express.

The problem is I want to use firebase auth to make login easier.

Everything for that is done client-side so.... is there any example on how should I use firebase Auth and how should I authenticate my request to my API in order to get which user it is on every request?

Maybe forward the token to the API? and then getting the info?

Thanks for your help.

There are definitely examples of this. What you'll want to do is look at the documentation for the Firebase Admin SDK , which is the SDK that you can run on trusted environments (such as App Engine) to perform actions that require administrative access.

In a typica scenario you'll use the Firebase Authentication SDK to sign the user in in the app, and then pass the ID token to your App Engine back-end . There you'll validate and verify the token , and then perform whatever actions the user is authorized to perform according to your rules.

If you'd be using a Firebase database (either Realtime Database or Cloud Firestore) you would be able to pass the token along and enforce authorized access in Firebase's server-side security rules. But since you're using Cloud SQL (which isn't aware of Firebase), you'll need to enforce your authorization rules in your own App Engine code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM