본문 바로가기
FrontEnd/React.js

JWT 관련 면접 질문 모음

by 위그든씨 2025. 4. 26.


1. Explain the difference between request and response interceptors in Axios.

Request interceptor: 요청 보내기 전 가로채서 수정.

Response interceptor: 응답 받은 후 가로채서 처리.


2. How would you add a custom header to all Axios requests using interceptors?

axios.interceptors.request.use(config => 
	{ 
    	config.headers['Custom-Header'] = 'value'; return config; 
    });


3. What is a JWT, and what are its three components?

JWT (JSON Web Token)는 인증에 사용하는 토큰. 세 부분: Header, Payload, Signature.


4. Explain the difference between signed and encrypted JWTs.

Signed JWT: 변조 방지 (서명).Encrypted JWT: 데이터 자체를 암호화해서 보호.


5. How do you store JWTs on the client side? What are the trade-offs between localStorage and cookies?

localStorage: 간편하지만 XSS에 취약.

Cookies (HttpOnly): 더 안전하지만 CSRF 공격 주의.


6. What measures can you take to prevent JWT from being tampered with?

비밀키로 서명(Sign)하고, 서버에서 서명 검증.


7. How can you prevent a JWT from being stolen (e.g., token hijacking)?

 HTTPS 사용- 토큰 짧은 수명 설정-

HttpOnly 쿠키 저장-

토큰 재발급(refresh) 전략 사용


8. What is JWT, and why is it used?

인증, 권한 부여 등에 사용하는 가볍고 안전한 토큰 포맷.


9. What are the three parts of a JWT? Explain their purpose.

Header: 타입과 알고리즘.Payload: 사용자 데이터.Signature: 무결성 검증.


10. How does JWT differ from session-based authentication?

JWT: 클라이언트가 토큰 저장.Session: 서버가 세션 저장.


11 . How can you include a JWT in the headers of an Axios request?

axios.defaults.headers.common['Authorization'] = 'Bearer ' + token;

 

 

https://dev.to/shemanto_sharkar/questions-for-react-job-interview-587m

 

Questions for React job interview

Explain the difference between request and response interceptors in Axios. How would you add a custom...

dev.to