IO-3166-Global-Notifications-Part-2 - Checkpoint
This commit is contained in:
@@ -14,12 +14,15 @@ const redisSocketEvents = ({
|
||||
// Socket Auth Middleware
|
||||
const authMiddleware = async (socket, next) => {
|
||||
const { token, bodyshopId } = socket.handshake.auth;
|
||||
|
||||
if (!token) {
|
||||
return next(new Error("Authentication error - no authorization token."));
|
||||
}
|
||||
|
||||
if (!bodyshopId) {
|
||||
return next(new Error("Authentication error - no bodyshopId provided."));
|
||||
}
|
||||
|
||||
try {
|
||||
const user = await admin.auth().verifyIdToken(token);
|
||||
socket.user = user;
|
||||
|
||||
Reference in New Issue
Block a user