DEV Community

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

 
seanmclem profile image
Seanmclem

Thanks, also it seems like on your frontend code that firebase.initialize(config); would now be initializeApp instead of initialize;
For a WebApp atleast.

Thread Thread
 
emeka profile image
Nwakwoke Patrick Nnaemeka

Thanks for pointing that out. Will correct it

Thread Thread
 
seanmclem profile image
Seanmclem • Edited

Sorry but,

When you do:
return axios.get('https://your-api-url/articles', {headers:
authorization: 'Bearer '+ token})

You missed a bracket or two, and have not put authorization into another object inside headers. It should probably be

return axios.get('https://your-api-url/articles', {headers: {
authorization: 'Bearer '+ token}})

Thread Thread
 
emeka profile image
Nwakwoke Patrick Nnaemeka

Thanks again

Thread Thread
 
seanmclem profile image
Seanmclem • Edited

also, auth is a function
auth().setCustomUserClaims
🙃