title: ERROR: Forbidden Your client does not have permission to get URL /api/app from this server
body: <p>I'm having trouble accessing a JSON api that is inside of my Firebase account. I'll type "firebase deploy" in my terminal and it'll return the following url, </p>
  
  <blockquote>
    <p><a href="https://myProjectID.firebaseapp.com" rel="noreferrer">https://myProjectID.firebaseapp.com</a></p>
  </blockquote>
  
  <p>If I then enter it into my browser I get my <em>Index.html</em> page so I know it generally works. But being that I'm trying to access the API I search the URL/api/app which works when I run "firebase serve" but doesn't when I run deploy. It returns the following </p>
  
  <blockquote>
    <p>ERROR: Forbidden Your client does not have permission to get URL /api/app from this server</p>
  </blockquote>
  
  <p>however my gmail account is permitted on firebase and everything checks out but firebase &amp; cloud functions still won't let me access my API. Please help.</p>
  
  <p>This is my code.</p>
  
  <p><strong>INDEX.JS</strong></p>
  
  <pre><code>const functions = require("firebase-functions");
  const server = require(__dirname,"../server.js");
  const api = functions
    .runWith({ memory: "2GB", timeoutSeconds: 120 })
    .https.onRequest(server);
  
  module.exports = {
    api
  };
  </code></pre>
  
  <p><strong>SERVER.JS</strong></p>
  
  <pre><code>const express = require("express");
  const path = require("path");
  const logger = require("./middleware/logger.js");
  const cors = require("cors");
  
  const routes = require("./router/routes.js");
  
  let app = express();
  
  // Init Middleware
  app.use(logger);
  
  // Set static folder
  app.use(express.static(path.join(__dirname, "public")));
  app.use(cors({ origin: true }));
  app.use("/", routes);
  
  module.exports = app;
  </code></pre>
  
  <p><strong>FIREBASE.JSON</strong></p>
  
  <pre><code>{
    "database": {
      "rules": "database.rules.json"
    },
    "hosting": {
      "public": "public",
      "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
      "rewrites": [
        {
          "source": "**",
          "function": "server"
        }
      ]
    }
  }
  </code></pre>