DEV Community

Discussion on: Securing your express/Node.js API with Firebase auth

Collapse
 
eduardoricardez profile image
Eduardo Ricardez

How can i refresh token when expires

Collapse
 
vignzpie profile image
Vignesh Pai

@emeka , Can you add to it?

Collapse
 
emeka profile image
Nwakwoke Patrick Nnaemeka

Firebase handles that for you, just call the getIdToken function when you need a token

Thread Thread
 
gabrielem profile image
Gabriele Marazzi

this is not 100% correct, to force firebase to refresh the token you need to add a true in the function getIdToken(true) otherwise you get the same token until it expire.

Collapse
 
emeka profile image
Nwakwoke Patrick Nnaemeka

Firebase handles that for you, just call the getIdToken function when you need a token

Collapse
 
iampaoloxd profile image
Paolo

hi i am having trouble with the token because it only live for 1hour. My question is if i call 'getIdToken' on every request, can this cause a performance issue or will it billed me much on firebase ? Thanks

Thread Thread
 
emeka profile image
Nwakwoke Patrick Nnaemeka

You definitely won't be billed more and I haven't had any issues with performance because the request is really fast.