Namrata
Namrata

Reputation: 31

ArgumentException: The 'ClientId' option must be provided. (Parameter 'ClientId')

I am using google authentication in core 3.1. Previously, my code was working fine but after having system format the project is giving me an exception. *ArgumentException: The 'ClientId' option must be provided. (Parameter 'ClientId') Microsoft.AspNetCore.Authentication.OAuth.OAuthOptions.Validate()

I have given the Client ID in startup which is like this:

services.AddAuthentication()
.AddGoogle(options =>
{
    IConfigurationSection googleAuthNSection =
        Configuration.GetSection("Authentication:Google");
    options.ClientId = googleAuthNSection["7111841*********"];
    options.ClientSecret = googleAuthNSection["uc**************"];
});

Please help me with this

Upvotes: 3

Views: 4095

Answers (1)

Diven Desu
Diven Desu

Reputation: 41

This is a little late but I had this same problem. After beating my head around it I found that the issue (at least for me) was I had pointed the parameter wrong. Make sure your client ID parameter points to a real location and that you don't have anything misspelled.

Upvotes: 2

Related Questions