Skip to content

REST API requests fail locally after migrating to v21 #2479

Answered by emmenko
emmenko asked this question in Q&A
Discussion options

You must be logged in to vote

Hi 👋,

In v21 local development of Custom Applications uses a new login workflow via OpenID Connect (OIDC). This results in having the session token stored in sessionStorage and requests must be authenticated using the Authentication HTTP header.

This is different from before, where we were using cookie based authentication.

See https://docs.commercetools.com/custom-applications/concepts/merchant-center-api#authentication

So if you configure the request manually, you need to pass the Authentication header.

The session token can be retrieved from sessionStorage:

const sessionToken = window.sessionStorage.getItem('sessionToken');

And pass it in the HTTP header

const getOrders = () => {
  return

Replies: 1 comment

Comment options

emmenko
Feb 9, 2022
Maintainer Author

You must be logged in to vote
0 replies
Answer selected by emmenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant