Monday, 20 March 2023
  14 Replies
  1.1K Visits
  Subscribe
how can you send the token in the header with the connection with signalr
1 year ago
·
#1457
Hello,

Configure the TsgcWebSocketClient to send the Bearer token in the Authentication property (enable only the Token section of the authentication property)


oClient := TsgcWebSocketClient.Create(nil);
oClient.Authorization.Enabled := true;
oClient.Authorization.Token.Enabled := true;
oClient.Authorization.Token.AuthToken := 'your token';
oClient.Authorization.Basic.Enabled := false;
oClient.Authorization.URL.Enabled := false;
oClient.Authorization.Session.Enabled := false;
.....


Kind Regards,
Sergio
And is there an option to skip negotiation?
1 year ago
·
#1465
No, the handshake is mandatory using the websocket protocol
1 year ago
·
#1473
Hub clients usually have this property.

I am getting a 404 not found in negotiation.Why can it be happening?

thank you very much for the previous answers
1 year ago
·
#1482
Hi,

OK, you mean during the signalr negotiation not during the websocket handshake, sorry for misunderstanding. Currently is not supported to pass a bearer token during the negotiation but I'll implement for the next release.

Kind Regards,
Sergio
1 year ago
·
#1483
Hi,

I've implemented the Bearer Token as SignalR Authentication, this will be included in the next release, I plan to publish the new release the next week.

Kind Regards,
Sergio
1 year ago
·
#1485
Hi,

Thank so much for the new implementation. If cant skip negotiation i will need it.

But im trying to connect to a Hub developed in .NET6 and i always receive 404 not found.

Attach:
-vStudio project with the Hub in .Net 6 and a Console app client to the hub
-Delphi project based on Demos/02.WebSocket_protocolos/07.SignalR_Server_and_Client/delphi

I have captured the traffic from the two clients and the esegece client always does the negotiation with "/signalr". You can see in the screenShoots

How could I call the attached hub from the esegece client?

Kind Regards,
Miguel
1 year ago
·
#1487
Hi,

Ok, I see, the problem is SignalR has changed the protocol in the latest versions, so this requires to implement those changes in the SignalR protocol. I will let you know when you can test the new version.

Kind Regards,
Sergio
1 year ago
·
#1488
Hi,

Forget the previous post, the component you need is SignalRCore, not SignalR. I've modified your sample to use SignalRCore client, with this component the client can connect to the SignalR Server.

https://www.esegece.com/download/samples/signalr_core.zip

More info about SignalRCore client:

https://www.esegece.com/help/sgcWebSockets/#t=Components%2FAPIs%2FAPI%2FAPI_SignalRCore.htm

Kind Regards,
Sergio
1 year ago
·
#1489
Hi Sergio,
Its works fine. Even i receive the authorization token in the negotiation. Thanks so much.
Hi Sergio,


It is possible to send the authorization header in the next calls instead of as a queyr parameter.
In my case I do not allow receiving the token by parameter for security reasons.

thank you so much


Versión: 2023.3.0: 2023 April
1 year ago
·
#1530
Hi,

Do you mean passing the token as an Authorization Bearer Token Header (instead of a query parameter)? yes, it's possible, I can create a property to handle this behaviour.

Kind Regards,
Sergio
Yeah that's what I meant to say
1 year ago
·
#1532
Hello,

Yes, I've added this feature to the latest beta.

Kind Regards,
Sergio
  • Page :
  • 1
There are no replies made for this post yet.
Submit Your Response
Upload files or images for this discussion by clicking on the upload button below.
Supported: gif,jpg,png,jpeg,zip,rar,pdf
· Insert · Remove
  Upload Files (Maximum 10MB)