i8beef / HomeAutio.Mqtt.GoogleHome

MIT License
215 stars 29 forks source link

algorithm' cannot be a 'null' or an empty object" error #91

Closed sognen closed 4 years ago

sognen commented 4 years ago

Hi,

With the latest build I am getting an " 'algorithm' cannot be a 'null' or an empty object" error. See under for relevant log entries. I do not see this with v 1.2.0.124.

br, Cato

[14:18:12 INF] Loaded with configuration from: appsettings.json, /app/config/appsettings.Production.json [14:18:13 FTL] IDX10000: The parameter 'algorithm' cannot be a 'null' or an empty object. (Parameter 'algorithm') System.ArgumentNullException: IDX10000: The parameter 'algorithm' cannot be a 'null' or an empty object. (Parameter 'algorithm') at Microsoft.IdentityModel.Tokens.SigningCredentials.set_Algorithm(String value) at Microsoft.IdentityModel.Tokens.SigningCredentials..ctor(SecurityKey key, String algorithm) at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderExtensionsCrypto.AddSigningCredential(IIdentityServerBuilder builder, SecurityKey key, String signingAlgorithm) at Microsoft.Extensions.DependencyInjection.IdentityServerBuilderExtensionsCrypto.AddDeveloperSigningCredential(IIdentityServerBuilder builder, Boolean persistKey, String filename, RsaSigningAlgorithm signingAlgorithm) at HomeAutio.Mqtt.GoogleHome.Startup.ConfigureServices(IServiceCollection services) in /app/HomeAutio.Mqtt.GoogleHome/Startup.cs:line 253 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>cDisplayClass9_0.gStartup|0(IServiceCollection serviceCollection) at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>cDisplayClass15_0.gRunPipeline|0(IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>cDisplayClass8_0.b0(IServiceCollection services) at Microsoft.AspNetCore.Hosting.StartupLoader.ConfigureServicesDelegateBuilder`1.<>cDisplayClass14_0.gConfigureServicesWithContainerConfiguration|0(IServiceCollection services) at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services) at Microsoft.AspNetCore.Hosting.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.WebHost.Initialize() at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at HomeAutio.Mqtt.GoogleHome.Program.Main(String[] args) in /app/HomeAutio.Mqtt.GoogleHome/Program.cs:line 45

i8beef commented 4 years ago

I upgraded the IdentityServer libraries. In this version they changed how they serialize the tempkey when using the developer mode token generation, which is usually fine because you aren't supposed to use those beyond development. It also renames the tempkey.rsa file to tempkey.jwk, in a different format.

This means your old tempkey.rsa is invalid. You'll need to update to the version I just pushed (it fixes the filename change), delete your old tempkey.rsa, make sure that config/tempkey.jwk is persisted instead correctly (if you are mounting the entire config directory, you are fine already), and relink in Google Home.

But really, you should take this opportunity to move to your own signing certificates since you need to relink anyway.

sognen commented 4 years ago

Thanks, updated to the latest version and all is good.