These roles will be added to the authentication token after successful credentials validation. This file is responsible to validate the presence of user roles in the token. The function will fetch the token from the request header, validate it, and throw the required exception (if any).Īuth.js const jwt = require("jsonwebtoken") Ĭonst auth_token = req.header("x-auth-token") Ĭonst decoded = jwt.verify(auth_token, "jwtPrivateKey") Ģ.2.2 Validation of roles in the authentication token This file is responsible to validate the token passed in the request to fetch the data. validation of the authentication token and roles sent to the /api/messages endpoint. Restful API is very popular and commonly used to create APIs for web-based applications. The middleware folder is responsible for two items i.e. "test": "echo \"Error: no test specified\"
0 Comments
Leave a Reply. |