private async Task ExternalAPILogin(LoginViewModel model) { try { Log.Info("ExternalAPILogin"); string ESupportAPIUrl = ApplicationConfigurations.ECareAPIUrl; UserHelper userhelper = new UserHelper(); LoginModel user = new LoginModel() { username = model.Email, password = model.Password, grant_type = "password", schoolcode = ApplicationConfigurations.SchoolCode }; Log.Info("LoginUserAsync Call"); LoginModelResponse res = userhelper.LoginUserAsync(user).Result; if (res != null) { Log.Info("LoginUserAsync Success" + res.ToString()); Log.Info("Response is not null- " + res.access_token); List <KeyValuePair <string, string> > cookieData = new List <KeyValuePair <string, string> >() { new KeyValuePair <string, string>("access_token", res.access_token), new KeyValuePair <string, string>("token_type", res.token_type), new KeyValuePair <string, string>("expires_in", res.expires_in.ToString()), new KeyValuePair <string, string>("ESupportAPIUrl", ESupportAPIUrl), }; CookiesHelper.SaveData(Response, cookieData); Log.Info("Data Saved in cookies"); } } catch (Exception ex) { Log.Error("ExternalAPILogin Error- " + ex.Message.ToString()); } }