Alex
Recommend book/source
Hi, I know how to program small applications, but I want to learn how to build programs like file system explorer, task manager or notepad. Is there any book or source that teaches you system/application design and building with examples I mentioned about? I want to understand how to build application right way, and how they function.
8 replies
✅ Refresh Token + JWT + Identity
Hi! I can't find a way how to implement refresh token part with Identity. Most tutorials online don't use Identity and write their own implementation. Should I extend identity user or is there a better way? I want to learn how it can be done the right way.
6 replies
✅ Web API redirect back to client
I have a GET route that handles external authentication. On the client I have anchor
<a href="myapi:8080/sign-in/external/Google">Google</a>
to sign in with Google. If authentication is successful I want to return cookie (I'll change it later) and redirect back to client. I have one option to provide returnUrl
but I'm not sure if it is a right solution. How can I do it?
1 replies
✅ How to get Options from DI
I configured options for google authentication
CliendId
and ClientSecret
.
Here I want to get them from ServiceProvider
but I don't know how. Should I create ServiceProvider
var provider = builder.Services.BuildServiceProvider();
?
14 replies
✅ Malformed input: 321 is an invalid input length
I'm working with Asp.Net Core Identity. I use
GeneratePasswordResetTokenAsync(user)
to generate token and encode it with WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(token));
. Next I decode encoded token with Encoding.UTF8.GetString(WebEncoders.Base64UrlDecode(encodedToken))
and get exception:
How can I fix my problem?1 replies
✅ Store data for the game
How can I efficiently store lines for the picture player draws? Each line contains color, line width and points (x,y). I have a group object that will have array of drawn linesбword players need to guess and state "drawing","choosing word", "idle". I need the data for players who join after the round started. I need the data between signalR calls
1 replies
✅ SignalR client to client communication (chat)
Is it correct that I can't send messages from client to client directly using SignalR? Do I need to send http POST request to endpoint, then inside endpoint I get IHubContext and execute method ReceiveChatMessage?
(Client code)
4 replies
✅ what's the difference?
What's the difference between sending message to signalR endpoint directly and sending post to controller and execute it hubcinnection.sendasync method inside of it? I want to build game project based on signalr, one person draws the picture other guess what is it by typing it in chat. Can I use only one connection for both sending drawn pixels and chat messages? Should I send chat messages directly to signalR hub of to the post route of controller?
4 replies
How can I accept multiple clients?
I want to write my own http server using
TCP
and System.Net.Sockets
. Here is my code:
How can I accept multiple sockets? Should I create new Thread
for each socket (I'll add while loop later)? Also, should I store threads somewhere to finish them after I handled request? Maybe you can give any other advices on this topic26 replies
How to create first user (Admin)?
I have backend, users can create accounts, each account has role - admin or user. I want the first account to be Admin. Should I create it during database seeding or every time user register their account I check if it's first user and give him admin role? Or is there a better way?
Aslo accounts must be verified to log in to it and only admin users can verify other user account.
8 replies
✅ How to handle errors in services/controllers
Hi! I do most of work in services and then call the method in the controller. What's the proper way to handle errors that occur in service? I need return error to the frontend (the error model must be consistent). Is it fine to throw error in the services or is there a better way?
Here is example of
AccountService
method
10 replies
✅ Google External sign in using Identity
I want to learn how to implement a google external sign-in route (and Identity in general) in my
ASP.NET Web API
but I can't find any recent tutorial on that topic. Microsoft's official tutorial is for RazorPages
only and tells you to add AddAuthentication().AddGoogle()
and everything should work. I want to create it for Web API
because I need it for the React
front end. I found a few tutorials but they are 3-5 years old. Can you suggest any tutorials on this topic or for Identity
in Web API
in general? Also, I used it about 2 years ago and I had to create routes like register
and login
by myself using userManager
and signInManager
etc, now the tutorial suggests using MapIdentityApi
which serves pre-made routes which I can't modify. Is it a new way to use Identity
or it's just made for simplicity in tutorial only?4 replies