/// <inheritdoc/> public async Task <bool> Login([NotNull] string email, [NotNull] string password) { BasicRestFactory restFactory = new BasicRestFactory(); LoginService = restFactory.GetLoginService(); LoginResult result; try { result = await LoginService.Login(new LoginRequest() { Email = email, Password = password }); } catch { return(false); } _accessToken = result.Token; await _cacheService.Persistent.Roaming.SetValueAsync(Constants.Cache.Keys.AccessToken, (object)_accessToken); return(await Login()); }
public static async Task Login(string email, string password) { DiscordApiConfiguration config = new DiscordApiConfiguration { BaseUrl = "https://discordapp.com/api" }; BasicRestFactory basicRestFactory = new BasicRestFactory(config); ILoginService loginService = basicRestFactory.GetLoginService(); LoginRequest.Email = email; LoginRequest.Password = password; Loginresult = await loginService.Login(LoginRequest); Token = Loginresult.Token; IAuthenticator authenticator = new DiscordAuthenticator(Token); AuthenticatedRestFactory = new AuthenticatedRestFactory(config, authenticator); IGatewayConfigService gatewayService = basicRestFactory.GetGatewayConfigService(); SharedModels.GatewayConfig gateconfig = await gatewayService.GetGatewayConfig(); Gateway = new Gateway.Gateway(gateconfig, authenticator); }