Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • PezzA 2 posts 23 karma points
    19 days ago
    PezzA
    0

    Reading member Identity in SignalR hub.

    I was wondering if anyone could help me. I've been following along with the example to create a signalr hub on https://docs.umbraco.com/umbraco-cms/implementation/custom-routing/signalr (using 13LTS version), and also to setup member registration https://docs.umbraco.com/umbraco-cms/tutorials/members-registration-and-login.

    These great articles work well individually, but I'm struggling to get them working together, in that I'd like the signalr hub to know who the logged in member is. Accessing Context?.User?.Identity?.Name returns null.

    I've tried creating a token generation endpoint and passing that into the accessTokenFactory of the signalr hub builder on the client, but not had much luck. The asp.net core identity docs say that signalr should pick up the default identity cookie automatically (https://learn.microsoft.com/en-us/aspnet/core/signalr/authn-and-authz?view=aspnetcore-8.0#cookie-authentication), so wondering if I am missing some bit of config (the MS docs on this are a bit of a maze).

    If anyone could help that would be great.

  • PezzA 2 posts 23 karma points
    18 days ago
    PezzA
    1

    Figured it out.

    Websockets mapped to /umbraco/<hub> will use backoffice auth, and sockets mapped to /<hub will use front end user auth. As soon as I changed my hub route, all was good!

Please Sign in or register to post replies

Write your reply to:

Draft