public async Task GetLoginSession()
        {
            solidIdentity = null;
            try
            {
                var result = await JSRuntime.Current.InvokeAsync <object>("solid.auth.currentSession", null);

                Console.WriteLine($"Result: {result ?? ""}");

                if (result != null)
                {
                    JObject jObject = JObject.Parse(result.ToString());

                    solidIdentity = new SolidIdentity((string)jObject["issuer"]);
                    solidIdentity.SetId((string)jObject["webId"]);

                    string name = null;
                    try
                    {
                        var nameResult = await JSRuntime.Current.InvokeAsync <object>("blazorSolid.getUserName", solidIdentity.Id);

                        if (nameResult != null)
                        {
                            JObject nameObject = JObject.Parse(nameResult.ToString());

                            name = (string)nameObject["value"];
                        }
                    }
                    catch (Exception x2)
                    {
                        Console.WriteLine("NAME ERROR:" + x2.GetBaseException().Message);
                    }

                    if (!string.IsNullOrWhiteSpace(name))
                    {
                        solidIdentity.SetName(name);
                    }
                    else
                    {
                        Uri uri = new Uri(solidIdentity.Id);
                        solidIdentity.SetName(uri.DnsSafeHost.Split('.')[0]);
                    }
                }
            }
            catch { }
            if (solidIdentity == null)
            {
                LoginStateChanged?.Invoke(false);
            }
            else
            {
                LoginStateChanged?.Invoke(true);
            }
        }
        public async Task GetLoginSession()
        {
            solidIdentity = null;
            try
            {
                var result = await JSRuntime.Current.InvokeAsync <object>("solid.auth.currentSession", null);

                Console.WriteLine($"Result: {result ?? ""}");

                if (result != null)
                {
                    JObject jObject = JObject.Parse(result.ToString());

                    solidIdentity = new SolidIdentity((string)jObject["issuer"]);
                    solidIdentity.SetId((string)jObject["webId"]);

                    string profile = null;
                    try
                    {
                        profile = await JSRuntime.Current.InvokeAsync <string>($"solid.data[{solidIdentity.Id}].user.name", null);

                        Console.WriteLine($"Profile: {profile ?? ""}");
                    }
                    catch (Exception x2)
                    {
                        Console.WriteLine("PROFILE ERROR:" + x2.GetBaseException().Message);
                    }
                    if (!string.IsNullOrWhiteSpace(profile))
                    {
                        jObject = JObject.Parse(profile.ToString());

                        solidIdentity.SetName((string)jObject["name"] ?? "Anonymous");
                    }
                    else
                    {
                        Uri uri = new Uri(solidIdentity.Id);
                        solidIdentity.SetName(uri.DnsSafeHost.Split('.')[0]);
                    }
                }
            }
            catch { }
            if (solidIdentity == null)
            {
                LoginStateChanged?.Invoke(false);
            }
            else
            {
                LoginStateChanged?.Invoke(true);
            }
        }
 public Task UserLoggedOut()
 {
     solidIdentity = null;
     LoginStateChanged?.Invoke(false);
     return(Task.CompletedTask);
 }