dotnet / dotnet/aspnetcore

SignalR Client C# - Custom Auth Scheme

Open
#10,576 12 comments 10 reactions 0 assignees View on GitHub
affected-very-few area-signalr enhancement Needs: Design severity-minor
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is your feature request related to a problem? Please describe.
I'm trying to override the Authorization scheme for C# SignalR Client e.g. not `Bearer`, however its doesn't seems possible as it seems to be hardcoded in https://github.com/aspnet/AspNetCore/blob/master/src/SignalR/clients/csharp/Http.Connections.Client/src/Internal/WebSocketsTransport.cs#L116

### Describe the solution you'd like
Ability to override the auth shceme, such as

```cs
new HubConnectionBuilder()
.WithUrl(url, opts =>
{
opts.AuthScheme = "Secret";
opts.AccessTokenProvider = () => Task.FromResult("XXX");
})
```

### Describe alternatives you've considered
Another option would be to pass the auth scheme in the `AccessTokenProvider` itself but might be breaking depends on how it's handled

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.