ASP .NET Core Server Integration

Hi! I’m new to Nakama so forgive me if this has been covered already.

I have a Unity game with a .NET Core REST backend and have recently added Nakama for Chat and Auth support. I am using Nakama primarily for Chat, Auth, and Clans (Groups).

Right now, I use the Unity plugin to auth and chat and that works great. However, for Clans, I plan on relying heavily on my custom backend and only using Nakama for clan search, join, and management. I do not want to write any custom modules or anything on Nakama. What I really want is to route my messages from Client=>Custom Server=>Nakama so I can control most of the clan operations and use Nakama only server to server for clan stuff.

My question is:

  1. Should I (Can I) use the Nakama .NET client library on my server to speak with Nakama or should I just use curl/REST directly.

  2. Either way, how do I authenticate on my server if I want to do user operations? Should I pass the auth token from the client to my server? Should I reauth on my custom server as the user? What are the best practices here and how should I go about it?

A concrete example would be joining a guild. I want the Join call to go from Unity client => Custom Server => Nakama to join the guild. I will then do some additional operations in my custom server. And finally return my custom result back down to the client. So the client would never really talk to Nakama directly about Clans in this case.

Thanks for the help! Great product so far, really impressed.

Hi @newatlanta19006. This is a great use case to add Nakama alongside the rest of your game services especially as you integrate new features.

Should I (Can I) use the Nakama .NET client library on my server to speak with Nakama or should I just use curl/REST directly.

The .NET client sdk has minimal dependencies and is used by lots of game teams in the way you’d like to integrate it. I would definitely use the .NET client direct in your codebase.

Either way, how do I authenticate on my server if I want to do user operations? Should I pass the auth token from the client to my server? Should I reauth on my custom server as the user? What are the best practices here and how should I go about it?

The best approach is to use the Nakama session token from the client and do a passthrough from your server to send the request to Nakama server. There’s no need to re-authenticate the user or attempt to reconstruct the session token (JWT).

Thanks for the help! Great product so far, really impressed.

Thanks for the kind words. Let us know if you have feedback on the server or API feature requests.