Although locally my ASP.NET Core website worked just fine, I ran into an internal server error when publishing it to Azure ("An error occurred while starting the application."). I found out more details on the exact error by passing .CaptureStartupErrors(true).UseSetting("detailedErrors","true")
to WebHostBuilder
in Program.cs
.
System.ArgumentException: The 'ClientId' option must be provided.
This refers to the Google authentication options as part of Configure()
in Startup.cs
.
app.UseGoogleAuthentication( new GoogleOptions()
{
ClientId = Configuration[ "Authentication:Google:ClientId" ],
ClientSecret = Configuration[ "Authentication:Google:ClientSecret" ]
} );
During development, these are successfully loaded using user secrets in Startup()
:
if ( env.IsDevelopment() )
{
builder.AddUserSecrets<Startup>();
}
According to the documentation, ClientId
and ClientSecret
should be specified in the Azure portal under 'Authentication / Authorization' of the web app settings. Even though I had originally specified there, the exception persists.
Am I missing something?