-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
질문이요
19.08.16 08:58 작성 조회수 161
0
JWT 발급 받을때요,
nodebird-call ---> nodebird-api 로 요청 하여, nodebird-api가 JWT 발급 해주잖아요.
Axios 는 이 두 개의 서버간의 응답을 주고 받게해주는 라이브 러리 이구요.
const URL = 'http://localhost:8002/v1';
const tokenResult = await axios.post(`${URL}/token`, {
clientSecret: process.env.CLIENT_SECRET,
});
지금 이부분에서 v1/token 으로 요청을 보냈잖아요.
그러면 nodebird-api 에서 라우터가 응답을 받고,
보내진 clientSecret이 디비에 있는지 확인하고
있으면 JWT를 발행 해주자나요.
router.post('/token', async (req, res) => {
const { clientSecret } = req.body;
try {
const domain = await Domain.find({
where: { clientSecret },
include: {
model: User,
attribute: ['nick', 'id'],
},
});
여기서 궁금한거는요, clientSecret: process.env.CLIENT_SECRET,
axios를 통해서 보냈는데, 왜 V1.js 는
const { clientSecret } = req.body;
왜 req.body를 통해서 받나요, 애초에 axios를 통해서 보내줄 필요가 없는거 아닌가요 ? ? ? ?
답변을 작성해보세요.
0
답변 1