Skip to content

Sample: api-key-protected-mock - Simulate API key authentication #20

@waldekmastykarz

Description

@waldekmastykarz

Summary

Create a sample that demonstrates API key authentication simulation for mock APIs.

Plugins to use

  • AuthPlugin - simulates API key authentication
  • MockResponsePlugin or CrudApiPlugin - for the API responses

What to build

  • Configure API key validation in header, query param, and cookie
  • List of allowed API keys
  • Sample app that includes API key in requests
  • Show 401 responses for missing/invalid keys

Configuration example

{
  "auth": {
    "type": "apiKey",
    "apiKey": {
      "parameters": [
        { "in": "header", "name": "x-api-key" },
        { "in": "query", "name": "code" }
      ],
      "allowedKeys": ["secret-key-123", "dev-key-456"]
    }
  }
}

Why this is compelling

Test API key authentication flows without real backend. Useful for Azure Functions, API Gateway integrations, etc.

Reference docs

  • AuthPlugin technical reference

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions