npm.io
2.22.7 • Published 4d ago

@medusajs/api-key

Licence
MIT
Version
2.22.7
Deps
0
Size
62 kB
Vulns
0
Weekly
0
Stars
36.8K

Medusa logo

@medusajs/api-key

Documentation | Website

Building blocks for digital commerce

Medusa is released under the MIT license. PRs welcome! Discord Chat Follow @medusajs

API Key Module for Medusa: manages publishable and secret API keys, including creating, revoking, and authenticating them. Publishable keys scope storefront requests (for example, to sales channels), and secret keys authenticate admin API requests. It ships with @medusajs/medusa and is registered by default, so you normally use it through the Medusa application rather than installing it directly.

At a glance

Package @medusajs/api-key
Type Commerce Module
Module key Modules.API_KEY ("api_key")
Registered by default Yes
Import from @medusajs/medusa/api-key

Features

  • Create publishable and secret API keys.
  • Revoke keys and authenticate requests with a key's token.

Installation

No installation needed. The module ships with @medusajs/medusa and is registered by default.

Usage

Resolve the module's service from the container, for example in a workflow step:

import { Modules } from "@medusajs/framework/utils"

const apiKeyModuleService = container.resolve(Modules.API_KEY)

Resources