mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 02:08:47 +00:00
Fix fbAuth function not extracting 'Bearer '
This commit is contained in:
parent
cc98fa7884
commit
c5bec46b52
@ -7,8 +7,8 @@ module.exports = (req, res, next) => {
|
||||
let idToken;
|
||||
|
||||
// Checking that the token exists in the header of the request
|
||||
if (req.headers.authorization) {
|
||||
idToken = req.headers.authorization;
|
||||
if (req.headers.authorization && req.headers.authorization.startsWith('Bearer ')) {
|
||||
idToken = req.headers.authorization.split('Bearer ')[1];
|
||||
} else {
|
||||
console.error('No token found');
|
||||
return res.status(403).json({ error: 'Unauthorized'});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user