Magento 2 Experten — Hyvä Theme, Tailwind CSS & SEO aus einer Hand ›

Admin Token: Fast Access for a First Result

Admin Token: Fast Access for a First Result

~11 Min. Lesezeit Zuletzt aktualisiert am August 8, 2026

Time for your FIRST real result: a valid access token and your actual Magento products as JSON – all BEFORE a single line of React Native code, via curl in the terminal.

Requesting a token via admin login

curl -s -X POST https://YOUR-SHOP.com/rest/V1/integration/admin/token \
  -H "Content-Type: application/json" \
  -d '{"username": "YOUR_ADMIN_USERNAME", "password": "YOUR_ADMIN_PASSWORD"}'

The response is a single, quoted JSON string – EXACTLY that string (without the outer quotes) is your token:

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

Achtung: For security reasons, NEVER write your real admin password into a file that could accidentally get committed. In chapter 6, we'll set up SECURE storage for ongoing use in the app.

Using the token for a real product request

TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

curl -s https://YOUR-SHOP.com/rest/V1/products?searchCriteria%5BpageSize%5D=2 \
  -H "Authorization: Bearer $TOKEN" | python3 -m json.tool

The response structure at a glance

{
  "items": [ { "sku": "...", "name": "...", "price": 19.99, ... }, ... ],
  "search_criteria": { ... },
  "total_count": 247
}

items is the array of actual products, total_count is the TOTAL number of matching products – important for pagination in chapter 8, where we use it EXACTLY as in the React web tutorial, for the FlatList.

Tipp: Did this curl call work for you? Then you just successfully communicated with REAL data from YOUR shop – everything else in this tutorial is "just" React Native code wrapped around it.

A note for shops with two-factor authentication enabled

Achtung: If two-factor authentication (2FA) is enabled for the admin area, POST /V1/integration/admin/token with plain username/password may fail. Recommendation: disable 2FA on a local test instance, or move straight to the integration token from chapter 5.