React职位面试问题
Explain the difference between request and response interceptors in Axios. How would you add a custom header to all Axios requests using interceptors? What is a JWT, and what are its three...
Axios的请求和响应拦截器可用于为所有请求添加自定义头。JWT由头部、载荷和签名三部分组成,签名JWT与加密JWT的主要区别在于安全性。JWT可以存储在localStorage或cookies中,各有优缺点。防止JWT被篡改和盗取的方法包括使用HTTPS和设置短期有效期。JWT用于无状态认证,区别于基于会话的认证,并可在Axios请求头中包含JWT。
