Skip to content

M2M service account authentication via API key - #70

Open
burkkyy wants to merge 4 commits into
mainfrom
caleb/dev
Open

burkkyy wants to merge 4 commits into
mainfrom
caleb/dev

Conversation

@burkkyy

@burkkyy burkkyy commented May 22, 2026

Copy link
Copy Markdown
Member

Context

YRHP requires access to YHSI api without a user login session.

Implementation

  • Added SERVICE_ACCOUNT_KEY env var — when set, enables M2M authentication
  • SERVICE_ACCOUNT_KEY unset (or empty) disables M2M entirely

Usage

  1. Generate a key and set it in the environment:
    openssl rand -hex 32
    In .env:
    SERVICE_ACCOUNT_KEY=<generated key>
  2. On each request add key to x-api-key header. Example usage:
curl https://your-api/api/place -H "x-api-key: <key>"

Change Request: Seed Service Account

A user with email service@yhsi.internal and status Active must exist in the database before M2M requests will work. Assign it the roles appropriate for the consuming application.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant