BlogsCompanyContactFAQsProductsServicesWhy Us
Brownsmith Dynamics

Services, products, company information, learning, and contact paths in one place.

HomeBlogsCompanyContactFAQsProductsServicesWhy Us

Services

AI ImplementationAI-Native SystemsWeb DevelopmentBusiness AutomationCustom SoftwareMCP DevelopmentLegacy ModernisationData and ReportingSEO, AEO and GEOPerformance MarketingTechnical Writing
  1. Home
  2. From Repository to Production
  3. Oauth and API Key Management
  1. Home
  2. Courses
  3. Self Hosting Open Source Applications
  4. From Repository to Production
  5. Oauth and API Key Management

Design, development, automation, SEO, and marketing systems for the AI age.

contact@brownsmithdynamics.com
RSS feed
BlogsCompanyContactFAQsProductsServicesWhy Us
Hostinger Partner affiliate marketing link

Affiliate link: Brownsmith Dynamics may receive a benefit if you purchase through this referral.

Sitemap

HomeProductsCoursesMCP DevelopmentServicesAI ImplementationAI-Native SystemsWeb DevelopmentBusiness AutomationCustom SoftwareLegacy ModernisationData and ReportingSEO, AEO and GEOPerformance MarketingTechnical WritingContact
Expand to See the Full SitemapCollapse the Full Sitemap

Core Pages

CompanyWhy UsAgent SkillsCase StudiesFAQsToolsQuizPrivacy PolicySubstack Publication

Founder Learning

Course BundleBuilding an AI-Native BusinessMVP Building for FoundersProduct and Interface DesignFrontend for FoundersBackend for FoundersDatabases for FoundersInfrastructure and DeploymentAI-Assisted Product BuildingTesting and Quality AssuranceSecurity, Ownership, and OperationsDesigning Work for AI AgentsSelf-Hosting Open-Source Applications

AI-Native Systems

AI-Native Business SystemsPublic AI DocumentationStructured Business Datallms.txt

Product Pages

Fonte UIPrivate Agent WorkspaceWeb Conversation EnginePrivate Model InfrastructureWorkflow Automation HubData Intelligence WorkbenchGrowth Intelligence PlatformWorkforce Intelligence SuiteContract & Compliance DeskIndustrial Operations PlatformHealthcare Operations WorkbenchLearning Operations PlatformSecurity Operations ConsoleProperty Intelligence SuiteCommerce Intelligence PlatformScreen Context AssistantPrompt Composer

Contact and Discovery

contact@brownsmithdynamics.comXML Sitemap

Core Pages

CompanyHomeWhy UsProductsCoursesAgent SkillsCase StudiesMCP DevelopmentFAQsToolsQuizPrivacy PolicySubstack Publication

Services

ServicesAI ImplementationAI-Native SystemsWeb DevelopmentBusiness AutomationCustom SoftwareMCP DevelopmentLegacy ModernisationData and ReportingSEO, AEO and GEOPerformance MarketingTechnical Writing

Founder Learning

Course BundleBuilding an AI-Native BusinessMVP Building for FoundersProduct and Interface DesignFrontend for FoundersBackend for FoundersDatabases for FoundersInfrastructure and DeploymentAI-Assisted Product BuildingTesting and Quality AssuranceSecurity, Ownership, and OperationsDesigning Work for AI AgentsSelf-Hosting Open-Source Applications

AI-Native Systems

AI-Native Business SystemsMCP DevelopmentPublic AI DocumentationStructured Business Datallms.txt

Product Pages

Fonte UIPrivate Agent WorkspaceWeb Conversation EnginePrivate Model InfrastructureWorkflow Automation HubData Intelligence WorkbenchGrowth Intelligence PlatformWorkforce Intelligence SuiteContract & Compliance DeskIndustrial Operations PlatformHealthcare Operations WorkbenchLearning Operations PlatformSecurity Operations ConsoleProperty Intelligence SuiteCommerce Intelligence PlatformScreen Context AssistantPrompt Composer

Contact and Discovery

Contactcontact@brownsmithdynamics.comXML Sitemap
Course Navigation
Self-Hosting Open-Source Applications
  1. 1.Self-Hosting Economics and Responsibility
  2. 2.Preparing a VPS, DNS, Ports, and TLS
  3. 3.Git and Repository Preparation
  4. 4.Building and Inspecting a Docker Image
  5. 5.Compose, Environment Files, and Secrets
  6. 6.Deploying with Coolify or Dokploy
  7. 7.OAuth and API Key Management
  8. 8.AI APIs and MCP Services
  9. 9.Private Access with Tailscale
  10. 10.Production Deployment and Recovery Capstone
Self-Hosting Open-Source Applications
  1. 1.Self-Hosting Economics and Responsibility
  2. 2.Preparing a VPS, DNS, Ports, and TLS
  3. 3.Git and Repository Preparation
  4. 4.Building and Inspecting a Docker Image
  5. 5.Compose, Environment Files, and Secrets
  6. 6.Deploying with Coolify or Dokploy
  7. 7.OAuth and API Key Management
  8. 8.AI APIs and MCP Services
  9. 9.Private Access with Tailscale
  10. 10.Production Deployment and Recovery Capstone
  1. Courses
  2. /
  3. Self-Hosting Open-Source Applications
  4. /
  5. From Repository to Production
  6. /
  7. OAuth and API Key Management

OAuth and API Key Management

OAuth credentials and API keys must be issued to organisation-owned accounts, restricted by environment and scope, stored outside source control, and rotated through a documented two-key transition where the provider allows it.

14 minute lessonUpdated July 30, 2026intermediate

What You Will Be Able to Decide

  • Explain the role of oauth and api key management in a self-hosted system.
  • Apply the procedure to a real open-source deployment.
  • Recognise unsafe defaults and verify the resulting control.
  • Record enough evidence for another operator to repeat or recover the work.

Self-hosted applications often depend on external identity, email, storage, payment, or AI providers. Owning the server does not remove those trust relationships.

OAuth separates a user's authorisation from the application's identity. The client ID is usually public; the client secret authenticates the application and must remain confidential. The redirect URI is a security boundary because it decides where an authorisation response can return.

Credentials should identify an environment and a purpose. A development key, staging OAuth app, and production credential should not be interchangeable.

Technical term

OAuth redirect URI

The exact application URL to which an authorisation server returns the user after approval, usually carrying a short-lived code.

It is the verified return address on a secure delivery, not a general forwarding instruction.

The Working Model

Create provider applications under an organisation account, not a departing developer's identity. Register the exact HTTPS production callback from the self-hosted application's documentation and use separate provider applications for local, staging, and production environments.

Grant the smallest scopes required. Store secrets in the deployment platform's protected environment store or a dedicated secret manager, restrict who can reveal them, and make logs redact headers, tokens, and callback parameters.

Rotation should be rehearsed before an incident. Where a provider permits overlapping credentials, create the replacement, update and verify the application, then revoke the old credential. If overlap is impossible, schedule a maintenance window and prepare rollback.

Implementation Procedure

  1. List each provider, credential owner, environment, purpose, scope, creation date, and rotation procedure.
  2. Create separate OAuth clients and API keys for development, staging, and production.
  3. Register exact HTTPS callback URLs and avoid broad wildcard redirects.
  4. Inject credentials at runtime, confirm they do not appear in Git, images, logs, or client-side bundles.
  5. Test rotation and revocation, then record the evidence and next review date.
# Safe names in .env.example; never commit the real values
OAUTH_CLIENT_ID=
OAUTH_CLIENT_SECRET=
OAUTH_REDIRECT_URI=https://app.example.com/auth/callback
EXTERNAL_API_KEY=

Knowledge Check

Which OAuth value normally must remain confidential?

Controlled Practice and Fragile Practice

Controlled Practice

The deployment stays explainable, constrained, and recoverable.

  • Organisation-owned provider accounts and recovery methods.
  • Separate credentials with minimum scopes for each environment.
  • A tested rotation and revocation process.

Fragile Practice

Convenient shortcuts create hidden exposure or an unrecoverable dependency.

  • Embedding a secret in browser JavaScript.
  • Using a personal OAuth application for production.
  • Logging complete authorisation URLs or bearer tokens.

Exercise

Apply the Boundary

Select the controls appropriate for a production OAuth integration.

Select all answers that apply

Verification and Recovery Evidence

  • Authentication succeeds from the public production hostname and fails for an unregistered callback.
  • Secret scanning finds no live credential in repository history or application bundles.
  • A replacement credential can be deployed and the old credential revoked.

Knowledge Check

What is the safest credential rotation sequence when overlap is supported?

Warning Signs

  • A production integration depends on one person's provider account.
  • An API key appears in a client-side network request.
  • No one knows what will stop working when a credential is revoked.

Questions to Ask a Consultant

  • Who owns and can recover each provider account?
  • Which scopes are necessary for the exact workflow?
  • Can credentials rotate without a long outage or an unreviewed emergency change?

Exercise

Founder Decision Note

Record the decision, its current constraint, recommended option, main reason, primary risk, and the condition that would make you revisit it.

Key takeaway

Key Takeaway

Treat OAuth and API credentials as governed production dependencies: exact callbacks, least privilege, durable ownership, confidential storage, and rehearsed rotation.

Apply This Decision to Your Product.

Understanding a technical concept is useful. Applying it still depends on your product, users, budget, data, and operating constraints.

Brownsmith Dynamics can review an MVP scope, technical proposal, architecture, deployment plan, AI-assisted workflow, or existing application.

For corrections, questions, and suggested improvements to this lesson, contact us directly.

Book a Technical Consultation Ask a Question or Suggest an Improvement
Previous LessonDeploying with Coolify or DokployNext Lesson AI APIs and MCP Services

Related Lessons

  • Deploying with Coolify or Dokploy
  • AI APIs and MCP Services

On This Lesson

  1. OAuth Redirect URI
  2. The Working Model
  3. Implementation Procedure
  4. Knowledge Check
  5. Controlled Practice and Fragile Practice
  6. Apply the Boundary
  7. Verification and Recovery Evidence
  8. Knowledge Check
  9. Warning Signs
  10. Questions to Ask
  11. Key Takeaway