Hello all,
First time I'm posting here, and it's a bit of a crippling issue. Not sure if it's something I did or not, as I followed the exact directions given by FusionAuth for setting up login functionality.
In Firefox, the session tokens are being obtained and I'm able to authenticate users perfectly fine. However, in Chrome and Edge, it's sending the user through an infinite loop of trying to authenticate. I believe it's happening here in the "user.js" file:
const express = require('express');
const router = express.Router();
const request = require('request');
const config = require('../config');
router.get('/', (req, res) => {
// token in session -> get user data and send it back to the Angular app
if (req.session.token) {
request(
{
method: 'GET',
uri: `https://site.domain.com:${config.fusionAuthPort}/oauth2/userinfo`,
headers: {
'Authorization': 'Bearer ' + req.session.token
}
},
// callback
(error, response, body) => {
let userInfoResponse = JSON.parse(body);
// valid token -> get more user data and send it back to the Angular app
request(
// GET request to /registration endpoint
{
method: 'GET',
uri: `https://site.domain.com:${config.fusionAuthPort}/api/user/registration/${userInfoResponse.sub}/${config.applicationID}`,
json: true,
headers: {
'Authorization': config.apiKey
}
},
// callback
(error, response, body) => {
res.send(
{
...userInfoResponse,
...body // body is results from the registration endpoint:w
}
);
}
);
}
);
}
// no token -> send nothing
else {
res.send({});
}
});
module.exports = router;
If my own troubleshooting is correct, it's not obtaining the information properly, so it's sending a blank JSON back to the user, which my site then thinks means that the user is invalidated. It then sends the user back to the login, only to be validated, then it just continuously sends them through the loop again. Just to reiterate, it DOES WORK on Firefox, just not the Chromium based browsers.
Thank you for any help that you can give. FWIW, I have the site completely SSL signed and using the HTTPS protocol, except for the Express server itself.