Cert++
Close

Obtaining and sending OAuth access tokens for Data API calls

Key Takeaway

For a server-to-server Data API call, send a POST to /dwsso/oauth2/access_token with grant_type=client_credentials. Put your client ID and client password in an HTTP Basic Authorization header. Then send the returned token as Authorization: Bearer <access_token> on each Data API request.

When an external system such as a CRM calls the OCAPI Data API, each request must carry an OAuth 2.0 access token that proves who is calling. You register the client application in Account Manager to get a client ID and a client password. The application exchanges those credentials for a short-lived token, then sends that token as a Bearer token in every Data API request.

Two OAuth 2.0 contexts

OCAPI uses OAuth 2.0 in two contexts. Both are for cases where the shopping customer context of a JWT does not fit. The right context depends on whether a person is involved.

Server-to-serverBusiness Manager user
Who is involvedOne system talks directly to the Data API, with no end userA Business Manager user interacts with the system
Requests are authenticated in the context ofA client IDThat user
GrantClient credentials grantBusiness Manager user grant or Authorization Code Grant
APIsData APIShop API or Data API

An external system such as a CRM that calls the Data API on its own, with no end user, is the server-to-server case. That case uses the client credentials grant.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Given a business requirement, use OCAPI Shop and Data APIs to enable interoperability with an external system

0/10

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers. 796 members and growing.