Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

292
Vistas
I cant access a JWT token from a get request in express
const functions = require('firebase-functions');
const admin = require('firebase-admin');

admin.initializeApp()
const express = require('express');
const app = express();

const cors = require('cors');
const jwt = require('jsonwebtoken');
const bcrypt = require('bcrypt');

const initizalize = require('./passportConfig');
const bodyParser = require('body-parser')
app.use(bodyParser.json())


const cookieParser = require("cookie-parser");
app.use(cookieParser());

const db = admin.firestore()


app.get('/checkToken', function(req, res) {
  console.log('Cookies: ', req.cookies.token);
  res.sendStatus(200);
});



exports.app = functions.https.onRequest(app);

Example Image of Error

I can see on chrome dev tools that there is a token there but for some reason the token is undefined when the path /checktoken is called.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Try using credentials options in fetch options. Allowed values are 'same-origin' for same-origin requests, 'include' for all requests, 'omit' to omit the use of cookies. Fetch by default uses `'omit``. Docs

If you are using credentials: 'include', you must set the Access-Control-Allow-Origin header to * at the backend. If you are using cors module then simply do app.use(cors()), or app.use(cors({ origin: '*' })). Both are same.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda