I’m building a React application that receives a JWT token from external service as part of the Authorization header for security reasons. I need to extract this token in my React component to authenticate user.
However, I’m not sure how to access the Authorization header in my React application.
Can anyone suggest a reliable way to access the Authorization header in a React application, so I can extract the JWT token sent by external service?
enter image description here
i use react hook useEffect and try const authHeader = axios.defaults.headers.common[“Authorization”]; but its not getting
Muhammad Ibrahim Jan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.