When you click the email link, you will land on the following page

http://localhost:3000/auth/account-activate/eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6Im1lcm5jbXNAZ21hawicGFzc3dvcmQiOiJtbW1tbW0iLCJpYXQiOjE2NzE2MTAzNjAsImV4cCI6MTY3MTYxMzk2MH0.6H1Yliip-Vdbs6TLYR3KexTMjWBDPT9ffnqqE5p0

This will work only when we have React frontend. To try this using Postman, copy the token after /account-activate/ and use in Postman to send a POST request to /api/register endpoint

Create register endpoint

// routes/auth
router.post("/register", auth.register);

// controllers/auth
export const register = async (req, res) => {
  try {
    const decoded = jwt.verify(req.body.token, config.JWT_SECRET);
    console.log(decoded); // email , password
  } catch (err) {
    console.log(err);
    res.json({ error: "Could not complete registration. Try again." });
  }
};

To try it, use Postman to make a POST request by sending token in req.body

// url
http://localhost:8000/api/register

// token in body
{
    "token": "eyJhbGciOiJIUzI565cCI6IkpXVCJ9.eyJlbWFpbCI6Im1lcm5jbXNAZ21haWwuY29tIiwicGFzc3dvcmQ56CJpYXQiOjE2NzE2MTAzNjAsImV4cCI6MTY3MTYxMzk2MH0.6H1Yl56-Vdbs6TLYR3KexTMjWBDPT9ffnqqE5p06V8"
}