olofd / react-native-signalr

Use SignalR with React Native
150 stars 61 forks source link

Cannot add authorization header #31

Open tmdude9586 opened 7 years ago

tmdude9586 commented 7 years ago

I'm trying to connect to my hub, however it requires an Authorization header to be present. I'm looking through the code and documentation, and I cannot find anyway to add said header to the XMLHttpRequest that gets sent.

Due to this I get 401s during the connection. Is there any way to add headers currently?

xahon commented 7 years ago

Looking source code i have found that: image I think passing headers should be like signalr.hubConnection(host, { headers: myHeaders })

xahon commented 7 years ago

Looks like my guess is not working

xahon commented 7 years ago

I just used query string to pass my headers in url. Passing qs instead of headers in my prior message as object will throw an error. I've created PR that fix that