Open jitugeo opened 4 years ago
I do this and it works:
<SockJsClient
url={`http://localhost:8080/ws`}
topics={topics}
headers={
{
Authorization: `Bearer token`,
}
}
debug
onMessage={(msg) => {
...do something
}}
/>
@aminmc It did not work for me.. can you see what is different here when you have a moment
<SockJsClient
url={SOCKET_URL}
topics={topics}
headers={
{
Authorization: Bearer ${accessToken}
,
}
}
subscribeHeaders={
{
Authorization: Bearer ${accessToken}
,
}
}
onConnect={onConnected}
onDisconnect={console.log("Disconnected!")}
onMessage={msg => onMessageReceived(msg)}
debug={false}
/>
@jitugeo Just wondering if you were able to find a solution to pass header? I am tryign to padd Authorization header with oauth token. Thanks!
i also cannot get headers to stick. the back end keeps thinking the Authorization header is null even though it can correctly handle other secured endpoints. I feel like its just a formatting issue on the prop but cant seem to get it to work.
I,m not able to pass the token in the header using SockjsClient. Here is my code
const customHeader = { Authorization: 'Basic token' }; this.stompClient.connect(customHeader, (res) => { }, (error) => { }) @lahsivjar can you help me what I'm missing here ? Thanks