mirror of
https://github.com/ClaytonWWilson/CS307-Team24.git
synced 2025-12-16 10:18:48 +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;
|
let idToken;
|
||||||
|
|
||||||
// Checking that the token exists in the header of the request
|
// Checking that the token exists in the header of the request
|
||||||
if (req.headers.authorization) {
|
if (req.headers.authorization && req.headers.authorization.startsWith('Bearer ')) {
|
||||||
idToken = req.headers.authorization;
|
idToken = req.headers.authorization.split('Bearer ')[1];
|
||||||
} else {
|
} else {
|
||||||
console.error('No token found');
|
console.error('No token found');
|
||||||
return res.status(403).json({ error: 'Unauthorized'});
|
return res.status(403).json({ error: 'Unauthorized'});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user