I am currently integrating Firebase Hosting with Firebase Functions to restrict access to .html content only to users with a valid Firebase token.
Within my iOS app, I can successfully send the token when accessing Firebase Hosting. The Cloud Function decodes the token without issues (I can see 'ID Token correctly decoded' in my Firebase Function log).
My index.html is located in a subfolder (/myhomepage) of the /functions directory (not inside "/public").
However, whenever I try to open the index.html, I encounter an error in my App's browser: "Cannot GET /". The Firebase Functions Log shows: "Function execution took 1654 ms, finished with status code: 404".
The following is the code inside index.js:
const admin = require("firebase-admin");
const functions = require('firebase-functions');
const express = require('express');
const cookieParser = require('cookie-parser')();
const cors = require('cors')({origin: true});
const app = express();
admin.initializeApp();
let db = admin.firestore();
// Express middleware for validating Firebase ID Tokens passed in the Authorization HTTP header.
// Firebase ID token should be passed as a Bearer token in the Authorization HTTP header like this:
// `Authorization: Bearer <Firebase ID Token>`.
// When successfully decoded, the ID Token content will be added as `req.user`.
// Rest of the code remains unchanged...
How can I properly access content within "/functions/myhomepage" once the token has been decoded successfully?