LeafyCode / express-firebase-auth

Firebase authentication middleware for Express.
MIT License
13 stars 8 forks source link

ignoreUrl did not work for GET request with param ?? #8

Open sacsand opened 6 years ago

sacsand commented 6 years ago

Example request

localhost:8088/jobapply?query={"page":1,"limit":10}
->error 404 notfound

console log the "req.originalUrl" result => " /jobapply?query=%7B%22page%22:1,%22limit%22:10%7D " for post,put request it console as => "jobapply"

so the ignoredUrls.includes(req.originalUrl) cant recognize get request with param since it passing with the param.

i did apply temp fix for now..this wont work if url include '?'

in index.js

   // split the url
  const urlFiltered = req.originalUrl.split("?");`

   // pass filtered url
    if (ignoredUrls && ignoredUrls.includes(urlFiltered[0])) {
      next(); // If the url is in `ignoredUrls`, skip the autherization.
}