I'm using passport-jwt. Assuming that I do social login(which is kakao or facebook), I get accessToken and refreshToken as callbacks from social login. Then, is it not necessary to do jwt.sign? like this code
const token = jwt.sign({ id: snsId, provider }, "jwt-secret-key");
In other words, I am wondering if it is only necessary to compare the accessToken and refreshToken passed by the social login without having to write a secret-key.
this is my code
module.exports = () => {
passport.use(
new KakaoStrategy(
{
clientID: process.env.KAKAO_ID,
callbackURL: "/auth/kakao/callback",
},
async (accessToken, refreshToken, profile, done) => {}
)
);
};
router.get(
"/kakao/callback",
passport.authenticate("kakao", {
session: false,
}),
async (req, res, next) => {
const { snsId, provider, accessToken } = req.user;
const token = jwt.sign({ id: snsId, provider }, "jwt-secret-key");
}
);