인프런 커뮤니티 질문&답변
google passport를 이용한 로그인 기능에 대해 질문이 있습니다
작성
·
268
답변 2
0
현병익
질문자
현재 공식문서에 따르면 처음에 router.get("/auth/google", passport.authenticate("google", {scope:["profile"]}))로 요청을 받아서 passport에 있는 google-strategy를 거쳐서 router.get("/auth/google/callback")으로 오게 되는데, 그럼 google/callback라우터에서 res.json을 하라는 말씀이신가요, 아니면 google/callback에서 프론트로 redirect한 이후에 거기서 다시 get("/user")call을 요청하라는 뜻 이신가요?
0





router.get('/auth/google/callback')은 백엔드이니 여기서 프론트 서버로 쿠키와 함께 redirect를 하고, 그 서버의 getServerSideProps에서 서버사이드렌더링하시면 됩니다.