Cannot get Session from Client when using AuthenticateEmailAsync

Hello everyone,

I am new to Nakama, I did read the tutorials to install Nakama and CockroachDB in a Docker’s container. I have the server and the database runing, I can actually confirming by accessing the server’s interface with the default admin and password credentials.

I am trying to do some tests, but I am stuck. I created a console application in .Net framework, I declare the client successfully and I try to authenticate.

I try to authenticate with the method below:

private async Task GetSession(Client client)
{
var email = “super@heroes.com”;
var password = “batsignal”;
return await client.AuthenticateEmailAsync(email, password, “batman”);
}

I can see in the server that the user batman has been created successfully, but the request do not return the session object, actually it does not return any response.

I tried reading the documentation and searching in google without luck.

Anyone could give me some tips? Am I in the right track?

Thanks in advance!

@Jorge Your code looks ok. I think where I can see a problem is that your method returns a Task rather than an ISession or a Task<ISession> so while the AuthenticateEmailAsync method returns a session you don’t actually use it right now. As a quick test you can change your code slightly:

private async Task GetSession(Client client)
{
    var email = “super@heroes.com”;
    var password = “batsignal”;
    var session = await client.AuthenticateEmailAsync(email, password, “batman”);
    System.Console.WriteLine(session);
    return Task.CompletedTask;
}

Hope this helps.

1 Like