0
votes

I have an API that I want to secure, I'm thinking of use Firebase ID tokens and include a token in every request, using:

firebase.auth().currentUser.getToken(/* forceRefresh */ true).then(function(idToken) {
        // Send token to your backend via HTTPS
    }).catch(function(error) {
        // Handle error
    });

and then verify the token.

Could this slow down the request to the API?

1
You don't need to force a refresh on each call. getToken will cache the valid token and only refresh it if it is expired. This may optimize things for you. - bojeil

1 Answers

0
votes

The answer is of course, yes, authentication will always slow down the request to the API. But it should be pretty minimal.