-
Notifications
You must be signed in to change notification settings - Fork 22
clientApi.AuthService.SendCodeAsync(phone).ConfigureAwait(false) doesnt work! #38
Comments
Me too . i have same problem |
can any admin share docs or video how to use this project.? |
I'm using the following code: private async Task _Connect()
{
Logger.Trace("Get client from client factory");
//Create the client
ClientApi = await ClientFactory.BuildClientAsync(Setting.GetFactorySettings()).ConfigureAwait(false);
// If the user is not authenticated
if (!ClientApi.AuthService.CurrentUserId.HasValue)
{
Logger.Trace($"Authenticate client '{Setting.PhoneNumber}' ..");
// Auth
var sentCode = await ClientApi.AuthService.SendCodeAsync(Setting.PhoneNumber).ConfigureAwait(false);
TUser user;
try
{
Console.WriteLine($"Please insert authentication code '{Setting.PhoneNumber}'!",
"Authenticate code required");
var code = Console.ReadLine();
if (!string.IsNullOrEmpty(code))
user = await ClientApi.AuthService.SignInAsync(Setting.PhoneNumber, sentCode, code)
.ConfigureAwait(false);
}
// If the phone code is invalid
catch (PhoneCodeInvalidException ex)
{
Logger.Error(ex.Message);
}
}
} This works without any problems |
at quick start (https://github.com/OpenTl/OpenTl.ClientApi/wiki/Quick-Start) settings variable like this;
and code like here but doesnt work. // Create the client You wrote as a code that; //Create the client But how did you define settings variable in your code. in addition this I sent you an email for detail ;-) |
Sorry my fault, here is my public class TClientSetting
{
public string AppHash { get; set; }
public int AppId { get; set; }
public string ServerAddress { get; set; }
public string ServerPublicKey { get; set; }
public int ServerPort { get; set; }
public string PhoneNumber { get; set; }
public string PhoneNumberSentCode { get; set; }
public string SessionTag { get; set; }
public List<ObservedEntity> ObservedEntities { get; set; } = new List<ObservedEntity>();
public FactorySettings GetFactorySettings()
{
var settings = new FactorySettings
{
AppHash = AppHash,
AppId = AppId,
ServerAddress = ServerAddress,
ServerPublicKey = ServerPublicKey,
ServerPort = ServerPort,
SessionTag = $"TSession_{PhoneNumber}", // by defaut
Properties = new ApplicationProperties
{
AppVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString(), // You can leave as in the example
DeviceModel = "PC", // You can leave as in the example
LangCode = "de", // You can leave as in the example
LangPack = "tdesktop", // You can leave as in the example
SystemLangCode = "de", // You can leave as in the example
SystemVersion = "Win 10 Pro" // You can leave as in the example
}
};
return settings;
}
} |
you have to use the certificate with "returns" and work fine |
Hi I try to use this api but client doesnt work.
System.NullReferanceExeeptions -->
The text was updated successfully, but these errors were encountered: