public async Task <string> GetLoginJavascriptCode(ClaimsIdentity identity, string returnUrl) { identity.CheckNotNull(nameof(identity)); UserClientStore.CheckNotNull(nameof(UserClientStore)); var userClients = UserClientStore.GetUserClients(identity.Name); var allowHosts = userClients.Where(p => !p.Host.IsNullOrWhiteSpace()).Select(p => p.Host).ToList(); identity = identity.InitializeWithAllowHosts(allowHosts); var token = await GenerateToken(identity); var loginNotifyUrls = userClients.Where(p => !p.LoginNotifyUrl.IsNullOrWhiteSpace()).Select(p => p.LoginNotifyUrl).ToList(); return(Javascript.GetLoginCode(token, loginNotifyUrls, returnUrl)); }