Magento Open Source REST API authentication options

Magento Open Source offers several ways to authenticate REST API calls, and each client type fits a different one. This page explains how to choose among them, what each one implies for token lifetime and two-factor requirements, and what to confirm before an integration goes live.

On this page

Magento Open Source REST API authentication: which method fits each client

Start by classifying each client that will call the REST API. A storefront or mobile app acts for a shopper, an admin tool acts for a staff member, and an ERP or PIM connector acts as a system with no person behind each request. Those three cases point to different authentication methods in Magento Open Source. The second question is whether a person or a system is acting, because that decides whether the credential should be tied to a user login that can expire and be revoked, or to an integration record that stays under administrative control. The third question is how long access should last. A short-lived session suits a browser or a phone that a shopper picks up daily, while a connector that synchronizes orders overnight needs a credential that does not depend on someone logging in each time.

The REST layer is documented in the magento/magento2 repository, and Adobe's developer documentation at Adobe Commerce PHP development overview covers the authentication model in more detail. Treat both as the basis for design, but confirm the exact behavior against the version you run. The current release line in the supplied facts is 2.4.9, and token handling, default settings and admin options can differ between lines. Test each client against a staging copy of your installed version before you grant production access, and record which method and which role each client uses.

Write the mapping down before any credential is issued. For each client, record the calling party, the data it reads and writes, the user or integration it authenticates as, the expected lifetime, and whether an administrator must be able to revoke it quickly. Ask your implementation partner or internal team to confirm how two-factor requirements apply to admin users who create or manage integrations, because those settings affect who can issue credentials at all. Detailed setup steps for each method are covered in the sibling topics on OAuth integrations and token lifetimes, so use this mapping to decide which of those paths applies to each client.

Authentication options and when each one fits

This table compares customer tokens, admin tokens, OAuth 1.0a integrations and session-based authentication by caller, typical use, who issues the credential, how it ends and the main trade-off. Read each row as the question to answer for a given API client, then match the client to the option that limits its access to what it needs. Token behavior and integration settings depend on your installed version and configuration, so confirm them in your own environment before you decide.

OptionTypical caller and useWho issues the credential and how it endsMain trade-off
Customer tokenStorefront or mobile app acting for one shopper to read the account, orders or saved dataThe customer signs in through the REST customer token endpoint; it ends by expiry or when the customer or an admin revokes itScoped to one customer, but a leaked token exposes that shopper's data until it expires or is revoked
Admin tokenStaff tool or script that calls admin-level endpoints under a named administrator accountAn administrator requests it with a username and password; it ends by expiry, password change or admin revocationBroad permissions tied to a person, so it breaks when that person leaves and must be revoked on offboarding
OAuth 1.0a integrationERP, PIM, marketplace or other third-party system needing resource-level access over timeAn admin creates the integration, sets resource permissions and activates it, which yields consumer keys and access tokens; it ends when the integration is deleted or tokens are revokedGranular resource access and no shared user password, but signing requests is more work and permissions must be reviewed as the connector changes
Session-based authenticationBrowser requests from the storefront or admin that already hold a logged-in session cookieThe Magento login flow issues a session cookie; it ends at logout or session timeoutNatural fit for the browser UI, but not designed for server-to-server or third-party clients
Bearer use of integration tokensClient that sends the integration access token in an Authorization headerSame issuer as the OAuth 1.0a integration; bearer handling is controlled by a configuration settingSimpler client code, but the setting is off by default and enabling it needs a documented reason and review
Two-factor requirementsAdmin users who sign in to obtain admin tokens or use the admin panelSet by the administration configuration and the two-factor modules enabled in your install; confirm the current setting for your versionStrengthens staff sign-in, but it does not replace scoping the token or limiting the integration's resources
Token lifetime settingsAdmin and customer sessions, mobile apps and long-running integrationsSet in your store configuration; confirm the expiration values in your own environment before setting client expectationsLonger lifetimes reduce re-login friction but widen the window for misuse after a credential leaks

Pick the authentication method by caller and client type

The diagram starts with whether a person or a system calls the REST API. A person is then sorted by whose behalf the call acts for: a shopper, or a staff member. Shopper calls split by client, with a browser or mobile app each receiving a customer token or session. Staff calls use an admin token, and the staff branch requires two-factor confirmation before a token is issued. System calls from a back-office connector use an OAuth 1.0a integration. Check each token's lifetime and revocation path before you settle on a branch.

Decision path from the caller to one authentication method.

Choosing authentication by client: storefront, mobile, admin tools and connectors

Storefront clients act on behalf of a shopper, so they use customer access tokens issued to the logged-in customer, plus guest cart identifiers for anonymous shoppers. The Luma and Blank themes manage this through server-side sessions, while a headless or custom front end calls the REST or GraphQL endpoints directly and must handle tokens itself.

  • Token storage: Keep customer tokens in memory or in an HTTP-only, secure cookie handled by a backend-for-frontend. Do not place admin or integration credentials in browser code.
  • Refresh behavior: Confirm whether your release issues refresh tokens for customers. If not, the front end must send the shopper back to sign-in when the token expires.
  • Failure mode: An expired token returns an authorization error mid-session, which can interrupt checkout or leave a cart in an unexpected state. Test the path from expiry to re-login.
  • Resource permissions: Customer tokens carry the customer's own scope. Confirm that customer-facing endpoints do not expose other customers' orders, addresses or wishlists.
  • Guest flows: Guest carts use a masked cart identifier rather than a token, so plan how that identifier is stored and when it is discarded.

Before launch, confirm the token lifetime defaults for your release and test sign-in, session expiry and logout on every storefront path.

How token lifetimes change the design of each client

Token lifetime is a trade-off between user friction and exposure if a credential leaks, and the right setting depends on who or what holds the token. Short-lived tokens suit browser and mobile clients, where a person signs in, the app can ask them to sign in again, and a stolen token stops working after a limited window. Long-lived integration credentials suit servers such as an ERP connector or a marketplace sync that run on a schedule without anyone present to re-authenticate. For those, a forced expiry can break nightly jobs, so the usual control is tight resource permissions and rotation rather than frequent expiry.

Do not assume the defaults fit your store. Confirm the configured expiration values for admin and customer tokens in your own Magento Open Source installation, and record where they are set in the Stores configuration for your version. Also confirm which clients in your environment use bearer tokens, how often those tokens are refreshed, and whether any mobile app or headless front end depends on a long session. Changing one lifetime can affect several clients at once, so test each client against the new value before it reaches production.

Plan token revocation as part of the staff offboarding process, not as an afterthought. When an administrator leaves or changes role, the tokens they issued and the integrations they configured need a named owner, a review, and a revocation step. Adobe's developer documentation covers the token types, and the detailed expiration settings are described in the sibling topic on customer and admin token lifetimes, which should be your next read before you set final values.

Set up REST authentication for an integration client in sequence

This sequence takes an integration client from a verified Magento Open Source install to a working, least-privilege REST credential. Each step ends with a check, so the team can confirm the granted access before the client goes live.

  1. Confirm the installed version and endpoint response

    Confirm which Magento Open Source version is running and that the REST endpoints answer on the target environment, using a read-only request to the store's public REST root. Compare the installed version against the 2.4.x line you plan to support, since Adobe publishes end-of-support dates per release and the matrix of PHP, MySQL or MariaDB, OpenSearch and Redis or Valkey versions changes by release. Done when the version is recorded in the change ticket and the endpoint returns a valid response rather than a server error. Ask your platform team to confirm the version number from the installed codebase, not from memory.

  2. Create the integration with scoped resources

    In the Magento Admin, create a new integration and select only the resource permissions the client needs, such as specific catalog or order resources, rather than granting all resources. Name the integration after the client and its owner so access can be traced later. Done when the saved resource tree matches the written access list approved by the data owner. Treat any resource the client does not need as a finding to remove before activation.

  3. Activate the integration and record the credentials

    Activate the integration in the admin, which generates the consumer key and consumer secret, then record them in your team's secrets store with restricted access. Do not paste them into tickets, chat or shared documents. Done when the integration shows as active and the credentials are stored under the named owner. Confirm that the admin user performing the activation is the one authorized to do so under your change process.

  4. Generate the access tokens

    Complete the OAuth handshake for the integration so the client receives its access token and access token secret. Store these in the same restricted secrets location as the consumer credentials, and note the token creation date for later lifetime and rotation reviews. Done when the client holds a working token pair and the record shows which integration it belongs to. If your environment uses the admin-created token flow instead, confirm which flow your Magento version documents for this integration type.

  5. Make an authorized test call

    Call an endpoint the integration is granted, using the access token, and confirm the response contains the expected data for that resource only. Use a read request first so the test does not change store data. Done when the response matches the granted resource and the call is logged with the integration's identity. Record the request, response code and timestamp in the change record without including the token itself.

  6. Confirm a denied resource returns an authorization error

    Call an endpoint the integration was not granted, such as a resource outside its approved list. Done when the call returns an authorization error and no data leaks through. If the denied call succeeds, stop the rollout, review the resource tree and the role assignment, and retest before the client goes live. Repeat this check after any change to the integration's permissions.

  7. Confirm bearer use matches team policy

    Check the store's configuration for bearer token use in the REST and integration settings, then record whether it is enabled or disabled. Compare the result with your team's written policy on token types and the clients allowed to use them. Done when the setting value and the policy decision agree and both are documented. Ask your security team to confirm the policy before you change the setting, and confirm the current default in your installed version's documentation.

Two-factor requirements for staff and admin access

The two-factor setting on admin accounts decides who can create or revoke integration credentials. Integrations in Magento Open Source are created in the Admin, and the access tokens they generate are issued from that admin session. An administrator who signs in without a second factor, or who holds a role that is exempt from enrollment, can therefore reach the integration screens and change which API resources a connector can call. Before you approve any integration, confirm which admin roles can open System > Extensions > Integrations and which of those accounts must enroll in two-factor authentication. Treat that list as part of the integration's access review, not as a separate login policy.

Check the two-factor setup on your exact version rather than relying on memory of older releases. In the Admin, review which two-factor authentication modules are enabled and whether the setting requires every admin role to enroll or only selected roles. Record the roles that can manage integrations, the roles that can only read them, and any accounts that were created through the command line or a shared login. Ask your implementation partner or internal team to confirm the module names and enforcement options against the Adobe documentation for the release you run, because these controls have changed across the 2.4.x line.

The API token paths for shoppers and integrations do not replace staff two-factor controls. A customer token or an integration token authenticates a machine or shopper request, and it carries no admin login challenge, so a strong token policy cannot stand in for enrollment on staff accounts. Make this explicit in your access design and review the two-factor configuration with your compliance team before go-live, including how enrollment is handled for staff who leave and how their tokens are revoked. Document the result so that auditors can trace each credential back to an enrolled, authorized administrator.

Where two-factor and credential controls apply by client

Each client that calls the Magento Open Source REST API holds a different kind of credential, and each has a different owner for enforcing controls. Map every client to its credential type, its two-factor position and the person accountable before you choose an authentication method for it.

Staff admin logins

Staff who sign in to the Magento Admin use a browser session, and admin two-factor authentication is the control that applies to them. Store administrators, merchandisers and support staff should each have their own account, not a shared login. Confirm in your environment that two-factor is enforced for every admin role, that the security team owns the policy, and that the store team cannot disable it for their own accounts.

Integration owners who create credentials

An integration owner creates the consumer key and access token that an ERP, PIM or marketplace connector uses. Creating an integration is an admin action, so the admin account that performs it is the control point. Confirm who is allowed to create integrations, which resources each one can reach, and that a named owner is recorded for every credential so revocation is possible when that person leaves.

Shopper accounts

Shoppers sign in to the storefront with customer tokens issued through the customer login endpoint. Do not assume a two-factor requirement applies here: confirm with your team and your extension stack whether storefront two-factor is available and whether your business needs it. Check how customer token lifetimes are set and whether your privacy and consent obligations for shopper data have been mapped.

Mobile app sessions

A mobile app that calls the REST API holds a customer or admin token on a device the store does not control. The main controls are token lifetime, how the app stores the token, and how a lost or replaced device is handled. Confirm with your app team how tokens are kept on the device, how long they stay valid, and how a user or administrator can end a session remotely.

Connector service accounts

Scheduled jobs and middleware that move product, order or stock data run as service accounts with integration credentials and no human at the keyboard. Two-factor cannot apply to these calls, so the controls are narrow resource permissions, secret storage outside the codebase and a documented rotation owner. Confirm which team holds each secret, which resources each connector can reach, and how you would revoke one connector without stopping the others.

Security and operational considerations for REST credentials

Treat every REST credential as a privileged secret from the day it is issued. The integration token, consumer key and secret, and any customer or admin token your code holds should be stored in a secrets manager that you control, injected into the ERP, PIM or marketplace connector at runtime, and never committed to a repository, written into env.php, or pasted into a shared ticket. Keep a written inventory that names each credential, its owner, the resources it can reach and the system that uses it. That inventory is what lets you revoke the right token quickly when a connector is retired or a staff member leaves. Ask your implementation partner to show where each credential is stored and who can read it before go-live, and confirm the procedure for revoking an integration in your own admin panel, since the exact steps depend on your installed version.

Plan rotation as a recurring task with a named owner, not as a reaction to an incident. Rotation means issuing a new credential, moving the connector to it, verifying the sync still succeeds and then revoking the old one, so build the sequence into the runbook and test it in a non-production store first. Token lifetimes set how often expired tokens must be replaced, so align that schedule with the lifetime settings your team chose. Review the list of active integrations and their resource permissions at a fixed interval, and remove any that no longer map to a live system. Logging matters here too. Capture authentication and API requests at the web server (for example, access logs from nginx) and in Magento's own logs, forward them to a central store, and alert on repeated failed authentication, unexpected source addresses and calls to admin-scope endpoints. Confirm the log locations and retention for your installed version with your team before relying on them.

Do not rely on Content Security Policy for API security. Magento Open Source supports Content Security Policy headers from 2.3.5, and from 2.4.7 CSP runs in restrict mode by default on storefront and admin payment pages, but CSP is a browser control that governs what pages can load and run. It does not inspect or stop a server-to-server call carrying a bearer token. Authentication, resource permissions and network controls, such as restricting admin and integration endpoints to known addresses or a private network, carry that load. Finally, patch every cycle. Adobe's upgrade guide recommends upgrading every patch cycle to stay secure and PCI compliant, and authentication behavior can change between releases, so a connector that worked on one patch level may behave differently after an upgrade. Include a regression run of every integration's authentication flow in each patch window, and confirm the current release and support dates on Adobe's release pages before you schedule the work.

Limits to confirm before you commit to a design

The authentication choice for each API client depends on details that vary by installed version, environment and internal policy. The cards below list the points to confirm with the right owner before the design is fixed, because a wrong assumption here changes which tokens, integrations and permissions you can use.

Token and integration behavior in your version

Token lifetimes, integration activation and the resource tree can differ between 2.4.x release lines, so the design should be checked against the exact installed version rather than documentation written for another one. Confirm with the platform lead which 2.4.x release and patch level is running in each environment, then test token issue, refresh and revocation on that build. Record the results in the design document so later upgrades can repeat the same checks.

Latest supplied release
2.4.9
Released versions

Bearer token use in the environment

Integrations that send bearer tokens rely on a configuration setting that is off by default, so an OAuth-based design can fail silently or behave differently across environments. Confirm with the store administrator whether bearer use is enabled in production, staging and development, and whether the setting is managed through a locked configuration file. Mismatched settings between environments are a common cause of failed connector tests after launch.

Custom module API resources

Custom modules can add their own REST endpoints and ACL resources, and those resources must be assigned to an integration or role before a client can call them. Confirm with the module developer which resources each module exposes, which ACL node protects each one, and whether any endpoint is anonymous. Without this check, an integration may pass its tests against core endpoints and then receive denied responses on the custom ones.

Varnish effect on authenticated responses

Self-managed installations commonly place Varnish in front of the store, and a cache layer can return stored responses to requests that carry different credentials. Confirm with the infrastructure team which URL patterns and API paths Varnish caches, whether authorization headers are passed through, and how cached responses are purged after token revocation. Test with two different tokens against the same endpoint to confirm that one client cannot receive another client's data.

Varnish cache guide

Mage-OS handling of the same APIs

If the team runs Mage-OS instead of Magento Open Source, the token and integration behavior, release timing and security patch flow may differ from Adobe's documentation even though the distribution is described as upstream compatible. Confirm with the Mage-OS Association's published release notes how the authentication endpoints and configuration keys are handled in the chosen release, and which Adobe security patches are ported and when. Document the distribution choice as a separate dependency in the design record.

Mage-OS site

Fit with internal access policy

Token lifetime, two-factor requirements for admin users and the scope of integration permissions must match the organization's access and identity policy, which often sets limits stricter than the product defaults. Ask the security or compliance owner to confirm the maximum acceptable token lifetime, who may approve integration access and how staff departures trigger token revocation. Record the policy owner's sign-off before development starts so the design does not need to be reworked during the security review.

Questions buyers ask before choosing REST authentication

How much effort does designing REST authentication take?

The effort depends mostly on how many API clients the store has and how different their access needs are. A design covering one ERP connector is much smaller than one covering an ERP, a PIM, a marketplace feed, a mobile app and a headless front end. The main drivers are the number of clients, the resources each one needs, custom module APIs that must be secured, the number of third-party integrations, and how often those clients change. Cost has two parts: internal staff time for the inventory and review, and any partner fees, which follow from a written scope. Most of the design work is one-time, but reviews recur whenever a client is added, changed or retired. Ask any quote to list the clients in scope, the resource lists, the testing steps and the documentation to be delivered.

Can our own team configure Magento OAuth integrations without outside help?

A team with administrator access can create an integration in the Magento Open Source admin, select resources, activate it and retrieve its consumer key and access tokens. The mechanics are not the hard part. The risk lies in choosing resources: granting an integration broader access than its job needs is the most common mistake, and it is hard to spot later. Your team can do the work well if one person understands each client's data flows and someone else tests the result in a non-production store. Check the default settings for token-based access in the documentation for your exact version, and confirm them with a test call before any production client is connected. Outside help is most useful when the design needs independent review.

What does the work need from our side before it starts?

Three inputs make the work start quickly. First, an inventory of every system that calls the store's APIs, including the owner, the purpose and the environment it runs in. Second, a resource list for each client: which catalog, customer, order, inventory or custom endpoints it reads or writes. Third, a named security owner who can approve the access model and sign off on token lifetimes and revocation. Also useful are a list of administrator accounts, the mobile apps that sign in as customers, and your offboarding process for staff who leave, because revoking their access is part of the design. Missing inputs usually cause rework later, so ask the provider to confirm in writing which of these they expect you to supply and which they will produce.

How long does a typical OAuth integration setup take?

No single duration applies, because the answer depends on scope. Setting up one integration with a settled resource list is a small task. Setting up several clients, each with its own permissions, test plan and connector team, takes longer, and the schedule often depends on the other side of each connection. The ERP, PIM or marketplace vendor may need their own changes, and custom module endpoints may need development before they can be granted. Testing in a non-production store and a review of each resource list add time. Ask for a schedule with milestones tied to named inputs, and ask which steps depend on work by your team or by a third party. A fixed-scope agreement sets the timeline in writing before work begins.

Does enabling two-factor authentication change API access?

Two-factor authentication for the admin panel mainly protects human sign-in to the admin interface, but its interaction with API access depends on how your version handles tokens and integrations. Do not assume it has no effect. Read the Adobe documentation for your exact version, then test three things in a non-production store: whether integration calls still succeed, whether administrator token creation still works, and what happens to existing tokens after a change to admin security settings. Record the results so that a later configuration change can be checked against them. If an integration breaks after a security change, the fix should be a deliberate access decision, not a broader resource grant.

How does token expiration affect mobile apps?

Shorter token lifetimes reduce the time a stolen token stays useful, but they force customers and staff to sign in again more often. Longer lifetimes are more convenient for mobile users but widen the window in which a leaked token can be abused. Your choice should match the data the app can reach. For a shopper app that reads orders and saves addresses, the trade-off is usually a balance between convenience and exposure. Whatever you choose, the app team must build the refresh and re-login flow, handle expired tokens gracefully, and test sign-out on lost or replaced devices. Confirm which lifetime settings your version offers for customer and admin tokens, and document the chosen values so that security reviewers can see the reasoning.

When should we bring in outside help for REST authentication?

Outside help is most useful when the design affects several systems, the store is headed for a headless front end, or the store is in PCI DSS scope and the access model must be defended to an assessor. It also helps when no one on staff has hands-on Magento development experience, or when an integration has already been configured with broader access than it needs. DeployOpen plans, implements, hardens and documents self-hosted platforms in your own infrastructure, and it can prepare the systems and evidence that an assessment will request. It does not issue audit reports or certifications; independent auditors and certification bodies do. Engagements are fixed-scope, and a quote follows from the written scope.

Do authentication settings change between Magento Open Source versions?

They can, so the answer should be checked against the release you run. Adobe recommends upgrading every patch cycle to stay secure and PCI compliant, and it lists customizations, extension count, third-party integrations and coding practices as drivers of upgrade effort. For authentication, the practical risk is that a patch or minor upgrade changes a default, a menu path or a token behavior that an integration relies on. Keep a written list of each client's settings, run its tests after every upgrade, and check the Adobe release notes and upgrade guide for the version you are moving to. Ask whether the upgrade plan includes re-testing each integration.

How DeployOpen scopes and delivers REST authentication work

DeployOpen plans, builds, tests and documents Magento Open Source REST API authentication inside your own infrastructure, so each API client gets the credential type it needs. We start from a written scope that names every integration, its permissions and its token rules, then hand the configuration and evidence to your team and remain available for ongoing support.

How we scope

  • Inventory every API client, including ERP, PIM, marketplace and mobile connectors, and record which authentication type each one needs.
  • Define resource permissions, token lifetimes and two-factor expectations for admin and integration accounts in the written scope.
  • Confirm the Magento Open Source version and PHP, database and cache combinations your environment runs before choosing authentication settings.

How we build

  • Configure integrations, consumer keys, access tokens and admin roles in a staging copy of your store before any production change.
  • Verify that bearer use, token expiry and session behavior match the documented design for each client, and record every exception.
  • Test requests against each endpoint group with least-privilege credentials, including attempts that should be refused.

How we hand over

  • Deliver a written configuration record listing each integration, its resource scope, token lifecycle and the owner who approved it.
  • Provide a runbook for rotating credentials, revoking tokens after staff leave and responding to a suspected token exposure.
  • Walk your engineering and security teams through the configuration so they can review it independently.

How we support

  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.
  • Ongoing support, upgrades and continuous testing are available as a retainer, including re-checking authentication after each Magento patch release.
  • Confirm with your own security team how retained testing findings and remediation tracking will be reported to them.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.