Page 1 of 1

signalr bearer token authentication

Posted: Mon 09 Mar 2020 11:29
by oscar
Hi All,

When using the TscHubConnection, how can i pass the required access token (jwt) used for authentication?

Tia, Rj

Re: signalr bearer token authentication

Posted: Wed 11 Mar 2020 14:19
by ViktorV
For authorization using Bearer Token, we do not have a separate property, therefore, to use it, you should also use the ScHubConnection.HttpConnectionOptions.Headers property. You can use the ScHubConnection1.HttpConnectionOptions.Headers.Add method to set the required values.
For example:

Code: Select all

ScHubConnection.HttpConnectionOptions.Headers.Add('Authorization', 'Bearer AbCdEf123456'); //The string "AbCdEf123456" in the example above is the bearer authorization token.