I haven't worked with Keycloak, but generally speaking, if you want to invoke a specific JavaScript function, you'd do something like this:
string txt = await jsRuntime.InvokeAsync<string>("methods.getText");
This would return a string from a JavaScript file that looked something like:
window.methods = {
getText: function () {
return "Some text";
}
};
You can learn more about invoking JavaScript functions from Blazor at: https://docs.microsoft.com/en-us/aspnet/core/blazor/call-javascript-from-dotnet?view=aspnetcore-3.1