How to log in with firebase and consume data from a local Rest api made with Node?

Asked

Viewed 162 times

0

I have a React-Native application that consumes the data of an api made with Node and Mongo.

And a simple application, is a CRUD of a "user" entity. However I have route protection using JWT in the Node backend which also generates a token for the Autenticacao.

In the React-Native application I log in using the Node local api , but would like to log in using firebase.

How can I do this? Log in to Firebase I know how, but from there how to proceed to consume Node’s api data?

I know it could all be at firebase, but as a matter of business rules it can’t be like this.

I am currently not using authentication(token) from either side(neither Ode , nor firebase). I’ll have to use both or should I choose just one of them?

1 answer

0

You can already import firebase and authenticate right?

Just protect your route with firebase authentication service.

const auth = 'SEU_FIREBASE_SERVICE';

router.post('/', auth.FUNCAO_AUTH, controller.post);
router.get('/', auth.FUNCAO_AUTH, controller.get);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.