TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ingo Manthey
NA
52
5.9k
SignalR authorization, Angular, ASP.NET Core
Jan 25 2020 7:51 PM
Hello,
In my app I use IdentityServer4 for my web API. Now I want to use SignalR but I always get error 401. With my other http.get <T> calls I have no problems.
[Authorize(AuthenticationSchemes = IdentityServerAuthenticationDefaults.AuthenticationScheme)]
public
class
ChatHub : Hub
In the Angular Service I initialize the hub as follows.
const
tokenValue =
'?token='
+
this
.authService.accessToken;
const
hubUrl = `${
this
.configurations.baseUrl +
'/hubs/chat?'
}looney${tokenValue}`;
this
.hubConnection =
new
signalR.HubConnectionBuilder().withUrl(hubUrl).configureLogging(signalR.LogLevel.Information).build();
For the other http.get I set the request headers as follows:
protected
get requestHeaders(): { headers: HttpHeaders | { [header: string]: string | string[]; } } {
const
headers =
new
HttpHeaders({
Authorization:
'Bearer '
+
this
.authService.accessToken,
'Content-Type'
:
'application/json'
,
Accept:
'application/json, text/plain, */*'
});
return
{ headers };
}
Can someone help me here??
Thanks in advance for any advice or tip
Reply
Answers (
1
)
Refresh Child after change Parent
Google charts with angular js (Table has no columns error)