If your SAP Commerce project is moving to 2211 for JDK 21, the OAuth change is the part that will bite you first. It looks like a small framework update. It isn’t.

On paper it’s just a library swap. In practice, login stops working, Swagger throws 401s, integrations that ran fine for years start failing, and someone in the team ends up searching “invalid_request authorizationserver” at 11 PM.
I have spent around 16 years on Hybris and SAP Commerce, and I have watched a lot of upgrades go past. This one is different because it touches every system that talks to your commerce backend: the storefront, the mobile app, the ERP and PIM integrations, SmartEdit, Backoffice, even your test tools.
So here is a plain, practical guide. What changed, what breaks, and a step-by-step plan to migrate SAP Commerce OAuth to the new Spring Authorization Server setup without a painful go-live.
What Changed in SAP Commerce OAuth with JDK 21
SAP rebuilt OAuth in Commerce Cloud on current Spring libraries in the September 2025 update. The old setup ran on Spring Security OAuth, which reached end of life back in 2022. It had to go.
The oauth2 extension is gone
The old oauth2 extension is removed. In its place you get three new extensions:
| Extension | What it does |
|---|---|
authorizationserver | Issues tokens. Handles login, authorize, token and revoke endpoints. |
resourceserver | Checks tokens on incoming API calls (OCC and your custom web services). |
oauth2commons | Shared code and models used by both. |
The split is cleaner. One part hands out tokens, one part checks them. That’s how Spring Security does it now, and SAP has followed.
Two login flows are removed
This is the big one. The Resource Owner Password flow (grant_type=password) and the Implicit flow are no longer supported.
If your storefront sends a username and password straight to /oauth/token, that stops working. Customer login now has to use Authorization Code flow with PKCE.
Clients are now Confidential or Public
Every OAuth client is now treated as one of two types:
- Confidential client: a backend system that can keep a secret safe. Think ERP, middleware, a batch job. Uses
client_credentials. - Public client: anything running in a browser or on a phone. It can’t keep a secret, so it has no secret, and uses Authorization Code + PKCE.
The platform also validates OAuthClientDetails more strictly now. A client set up loosely in the past may simply be rejected.
Tokens are JWTs
Access tokens are now signed JWTs. The resource server checks the signature instead of looking the token up in a database table. This is faster, but it brings a new concern: signing keys. More on that below.
Common Issues After the JDK 21 OAuth Upgrade
Before the plan, here is what usually goes wrong. If you know these upfront, you can test for them on day one instead of finding them in production.
- Storefront login fails. The old password flow is gone, so the login call gets rejected. Composable storefront (Spartacus) users also report 403 errors linked to CSRF and session cookies.
- Swagger UI returns 401. The OCC Swagger client was usually set up as a public client with a password flow. It needs Authorization Code + PKCE, and the redirect URI must be registered exactly.
- Integrations break. Many older integrations send
client_idandclient_secretas URL query parameters. The new token endpoint does not accept that. Credentials must go in the Basic auth header or the request body. - Tokens stop working after a restart. If the JWT signing key is generated at startup, every restart creates a new key, and every old token becomes invalid.
- Tokens expire faster. Validity settings you relied on may not carry over the same way. Check them on each client.
- A new token on every call. With
client_credentials, the server now returns a fresh token each time instead of reusing one. Integrations that request a token per API call will create a lot of them. - Backoffice SSO gives HTTP 500. Old Spring Security XML (voters, old expression styles) does not work on Spring Security 6.
- SmartEdit login breaks. SmartEdit moved to the new flow too, so any customisation around its login needs a look.
Step-by-Step SAP Commerce OAuth Migration Plan

This is the order I’d follow. Don’t jump straight to code. Most of the pain comes from systems nobody remembered were calling the token endpoint.
Step 1: Find every OAuth client and every caller
Start with an inventory. Pull all records from OAuthClientDetails through HAC or Backoffice, and write down for each one:
- Client ID and who owns it
- Grant types it uses today
- Which system calls it (storefront, app, ERP, PIM, payment, search, test scripts)
- Redirect URIs, scopes and token validity
Then search your codebase for anything built on the old extension. Look for custom token granters, token enhancers, TokenStore code, and imports from org.springframework.security.oauth2. Check the spring-security XML files in your OCC and custom web extensions too.
Any client still on password or implicit goes on a red list. Those need a redesign, not a config change.
Step 2: Classify each client as Confidential or Public
Go through the list and give every client one type.
| Caller | Client type | Grant types |
|---|---|---|
| ERP, PIM, middleware, batch jobs | Confidential | client_credentials |
| Storefront (Spartacus or headless) | Public | authorization_code, refresh_token + PKCE |
| Mobile app | Public | authorization_code, refresh_token + PKCE |
| Swagger UI | Public | authorization_code + PKCE |
Don’t reuse one client for everything. A separate client per system makes it easy to revoke one without breaking the rest.
Step 3: Update the OAuth client ImpEx
Here is an example of how the two types look. Treat it as a starting point and check the exact attributes against the docs for your patch level, since validation rules are stricter now.
INSERT_UPDATE OAuthClientDetails;clientId[unique=true];resourceIds;scope;authorizedGrantTypes;authorities;clientSecret;registeredRedirectUri;accessTokenValiditySeconds;refreshTokenValiditySeconds
# Confidential client - backend integration
;erp_integration;hybris;extended;client_credentials;ROLE_TRUSTED_CLIENT;<strong-secret>;;3600;
# Public client - storefront, no secret
;storefront_client;hybris;basic,openid;authorization_code,refresh_token;ROLE_CLIENT;;https://www.yoursite.com/login;3600;86400Two things to notice. The public client has an empty secret, which is expected for a public client. And the redirect URI has to match what the storefront sends, character for character.
Step 4: Swap the extensions
In localextensions.xml, remove the old one and add the new three:
<!-- remove -->
<!-- <extension name="oauth2" /> -->
<!-- add -->
<extension name="oauth2commons" />
<extension name="authorizationserver" />
<extension name="resourceserver" />Also check extensioninfo.xml in your custom extensions. Any requires-extension name="oauth2" must change, or the build will fail.
Step 5: Rewrite the custom code
This is where most of the effort goes.
- Custom claims: old token enhancers move to the new token customizer approach in Spring Authorization Server.
- Custom grant types: anything built on the old granter classes has to be rebuilt on the new model, or replaced with a standard flow.
- Login pages and handlers: the login page is now served by the
authorizationserverextension. Custom failure handlers and error codes need rework. - Security XML: move off old voters and expressions like
IS_AUTHENTICATED_FULLY. Use the Spring Security 6 authorization manager style.
Tip: before rewriting a custom grant, ask if you still need it. Half the custom grants I have seen were workarounds for things the standard flows now handle.
Step 6: Fix the callers
Storefront. Switch customer login to Authorization Code + PKCE. In composable storefront, this means turning on the authorization code flow in the auth config (authorizationCodeFlowByDefault) and pointing it at the new /authorizationserver/oauth/authorize and /authorizationserver/oauth/token endpoints.
Integrations. Send credentials in the header, not the URL:
curl -X POST https://<your-api-host>/authorizationserver/oauth/token \
-u "erp_integration:<secret>" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials"Ask every integration team to cache the token until it expires, instead of asking for a new one on every call.
Revoke calls. These now go to /authorizationserver/oauth/revoke, as a form post with proper client authentication.
Step 7: Set up stable JWT signing keys
Do not let the server create a new signing key on every start. Configure a fixed key pair, keep it in a secure store, and make sure every node uses the same one. Otherwise each restart logs everyone out, and on multiple nodes, a token issued by one node may fail on another.
Also plan for key rotation. Decide how often you’ll rotate, and keep the old public key for a while so live tokens still validate.
OAuth Migration Testing Checklist
Test on an environment with more than one node. A lot of these issues only show up when traffic hits different pods.
- Customer login, logout and refresh token on the storefront
- Guest checkout and anonymous cart, then login and cart merge
- Customer registration and password reset
- Each integration gets a token and calls its APIs
- Token still valid after a server restart
- Token issued on node A works on node B
- Token expiry and refresh match what each client expects
- Revoke works and the revoked token is rejected
- Swagger UI authorize works
- SmartEdit login and editing
- Backoffice login, including SSO if you use it
- Wrong password, locked and disabled accounts show the right error
- Clients with wrong redirect URI or wrong grant type are rejected
Go-Live Tips for the New OAuth Setup
Tell integration partners early. Their token calls change. Some of them work on quarterly release cycles, so a two-week notice will not be enough. Send them the new endpoint, the new auth style and a test client at least a month before.
Expect everyone to log in again. Old tokens won’t carry over to the new server. Put it in the release note, warn the support team, and pick a low-traffic window.
Watch the token endpoint after go-live. Keep an eye on 401s, 403s and token request volume for the first few days. A sudden spike in token requests usually means some integration isn’t caching its token.
Keep a rollback plan. Know exactly what you’ll do if login fails at 2 AM. That means a tested build to roll back to, and the old client data still available.
Use dry run where you can. SAP mentions a dry-run option for the new client validation rules. Use it in lower environments to catch bad client configs before they block anyone.
FAQ: SAP Commerce OAuth on JDK 21
Is the old oauth2 extension still available in SAP Commerce 2211 JDK 21? No. It has been removed and replaced by authorizationserver, resourceserver and oauth2commons.
Can I still use the password grant for customer login? No. The Resource Owner Password flow and Implicit flow are not supported anymore. Use Authorization Code with PKCE.
Do I need to change my integrations? Most likely, yes. At the very least, check that they send client credentials in the header or body and not in the URL, and that they use the new token endpoint path.
Why do all tokens fail after a restart? Usually because the JWT signing key is created fresh at startup. Configure a fixed, shared key.
Will customers be logged out after the upgrade? Yes, plan for a one-time re-login. Old tokens are not valid on the new authorization server.
How long does this migration take? It depends on how much custom OAuth code you have. A project with standard clients can move fast. A project with custom grants, custom claims and many integrations needs proper planning and a full regression cycle.
Final Thoughts
The new OAuth in SAP Commerce is a good change. It’s more secure, it follows current standards, and it removes a library that should have gone years ago. But it’s not a drop-in upgrade.
Treat it as a small project of its own. Do the inventory first, fix the callers, lock down your signing keys and test across nodes. If you do that, go-live is boring, and boring is exactly what you want.
If your team is planning this move and you’re stuck on any step, drop a comment. I’m happy to share what I know.
Sources
- SAP Learning: Framework Updates
- SAP KBA 3641255: New OAuth client validation and migration
- SAP KBA 3780745: Client credentials in query parameters
- SAP KBA 3685691: JWT tokens invalid after restart
#SAPCommerce #Hybris #SAPCommerceCloud #OAuth #JDK21 #SpringSecurity #SAPCX #Ecommerce

Leave a Reply