aspnet / SignalR-samples

Samples for ASP.NET Core SignalR
753 stars 398 forks source link

Add new sample #89

Closed h5aaimtron closed 5 years ago

h5aaimtron commented 5 years ago

SignalR Core Chat Sample with Auth (JWT)

dnfclas commented 5 years ago

CLA assistant check
All CLA requirements met.

h5aaimtron commented 5 years ago

I updated all the code and have the repos ready. Let me know if you want to proceed to create specific repos for them and what/if any naming you'd prefer.

bradygaster commented 5 years ago

Thanks for all that work over the weekend, @h5aaimtron. i'll clone your branch and give it a go and provided everything works just fine, I'd create an individual repo named sample_ChatWithAuthentication (unless @davidfowl has another idea) in the SignalR org and stash it there.

bradygaster commented 5 years ago

Also - It'd be great to have a page that's rendered for the user to actually use the API and Hub. From what I can gather in your fork, there's no UI or anything for a user to use. A README.md on how to try the sample out, or a UI making it easy for a user to "clone, build, and see" it working would be optimal. Is that possible given your scenario?

h5aaimtron commented 5 years ago

@bradygaster, I put the UI in a separate repo here: https://github.com/h5aaimtron/sample_chatWithIdentityClient

It's a relatively basic Angular 6 app. I wasn't sure if/how you'd like them merged or separate.

bradygaster commented 5 years ago

I think it'd be ideal if it were all in one place. As in, if you had two top-level folders, one of which contained the API and SignalR Hub and supporting "stuff," and then the second top-level folder contained this repo's contents.

h5aaimtron commented 5 years ago

I think I can manage that tonight. Do you have a preferred repo name and/or top level folder name preference for the 2 folders?

bradygaster commented 5 years ago

Nothing fancy - "client" and "server" are fine. :)

h5aaimtron commented 5 years ago

https://github.com/h5aaimtron/sample_chatWithIdentity

Cleaned it up a little bit. Let me know if there is any additional work that needs to be done.

bradygaster commented 5 years ago

really good work on the readme and re-organization. cloning and trying it out now - sorry for the delay, was wrapped up in a few other items yesterday.

h5aaimtron commented 5 years ago

Thank you and no worries. I really like .NET Core and SignalR specifically, so I wanted to give back a little bit. If there are any questions or anything unclear, let me know.

bradygaster commented 5 years ago

@h5aaimtron - I tried things out. Followed instructions and immediately noticed this error in the client side. Very close! I'd also advise you draw out the logged-in user's name. Would make it more evident that it's multiple users for those who want to pop open multiple browsers to give it a spin. Here's the error i'm seeing when I run both the server and the client.

image

h5aaimtron commented 5 years ago

@bradygaster I'll look over the code and make the error messages more reasonable. I suspect that the account wasn't created and therefor the token endpoint actually returned a unauthorized error that the client interpreted incorrect. I'll tag you once the changes are committed.

h5aaimtron commented 5 years ago

@bradygaster I updated the sample to return better error messages when registering or signing in. They aren't perfect, but will tell you if a problem happened. I also added information to the readme that you would need to setup a SQL server or SQL Express connection in the appsettings.json so that the necessary identity tables can be generated. I'm not seeing any errors on my end when running it at this point, but will await your confirmation.

bradygaster commented 5 years ago

Sounds good @h5aaimtron - sorry i just caught this thread, had been heads-down on a few other tasks but will dive back in to this tonight and get you feedback by end-of-week. thanks for the persistence and passion!

h5aaimtron commented 4 years ago

@bradygaster wanted to check in on this as its been a few months. If there is anything you need on this sample, let me know, or if you're looking for other complex examples, I may be of help. I'm personally using SignalR Core 2.2 in a personal project similar to Discord with voice chat. I'm hoping to release it in a few months and will likely do a sample app with a simple WebRTC mesh network to put out there.