-1

How to capture the headers of a 401 response or request? The server is returning this 401 to me since it needs a summary authentication, I need to create a hash to send it to the server from the MD5 algorithm, and I need to get the nonce from the 401 response to be able to calculate the MD5 algorithm, any ideas on how extract the headers the WWW-Authenticate nonce ? any ideas ?

I am using the JsSip.js library work with react js or js

I leave the answer in an image that should censor some things

enter image description here

2 Answers2

0

In order to retrieve the token from the header you should use Axios interceptors to and access it via req.headers,the proper header for a token is headers.authorisation:'Bearer tokenValue', docs

0

the same thing happens to me, I show you the configuration that I am using, can you tell me please if any information is missing? Since the 401 is not being answered automatically.

My code is:

var socket = new JsSIP.WebSocketInterface('wss://my.server.com/webrtc/')

var configuration = {
  sockets: [socket],
  uri: 'sip:TestUser@xxx.xx.xxx.xxx:5060',
  password: 'xxxxxxx',
  //contact_uri: 'sip:TestUser@xxx.xx.xxx.xxx',
}

var ua = new JsSIP.UA(configuration)

ua.start()

Thank you for your answer.