Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

499
Views
Error The 'ClientId' option must be provided. When building a docker image

I've started a new .net core project and I configured it to use the Google+ Api for authentication. My Client Id and Secret are stored using dotnet user-secrets. When I build my docker image I get

 Unhandled Exception: System.ArgumentException: The 'ClientId' option must be provided.

I know this is because my secrets aren't being provided to the image. What I want to know is how can I provide my Id and Secret key without committing them to the repository and still run my image locally.

I was thinking when I deploy it to the server I can have them as part of the Env variables, I guess I could do that locally too, just wondering if anyone else has a solution for this that may be more elegant than mine.

I just can't find much info on how others are doing this.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

To Add Google+ Authentication you can see this guide.

Add this snippet in startup.cs

services.AddAuthentication().AddGoogle(googleOptions =>
{
    googleOptions.ClientId = Configuration["Authentication:Google:ClientId"];
    googleOptions.ClientSecret = Configuration["Authentication:Google:ClientSecret"];
});

Add this line in appsettings.json

"Authentication": {
    "Google": {
        "ClientId": "ID FROM GOOGLE API",
        "ClientSecret": "SECRET FROM GOOGLE API"
}
over 4 years ago · Santiago Trujillo Report

0

First of all, secrets is not what you should use for deploying. Secrets exists for safe storage during development by helping prevent sensitive data from being storing in code / checked into source control. See related question How do UserSecrets work in the Cloud?

And you are right, that you should use Environment Variables for instead, or as alternative, some external settings storage like DB.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!