dsuryd / dotNetify

Simple, lightweight, yet powerful way to build real-time web apps.
https://dotnetify.net
Other
1.17k stars 164 forks source link

JWT Token #200

Closed msamara closed 5 years ago

msamara commented 5 years ago

Any idea hot to send JWT token upon connecting? currently getting 401 status code when negotiating with the initial connection, I had this before, JWT token needs to be sent with the request as in original SignalR:

connection = new HubConnectionBuilder() .withUrl( ${Vue.prototype.$http.defaults.baseURL}/question-hub, jwtToken ? { accessTokenFactory: () => jwtToken } : null ) .configureLogging(LogLevel.Information) .build()

dsuryd commented 5 years ago

DotNetify has a custom JWT handling; the token is passed inside websocket request instead the URL query string. Consequently following SignalR documentation on token authentication won't work, you need to follow dotNetify documentation on the subject.