> For the complete documentation index, see [llms.txt](https://helpcenter.etron.info/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://helpcenter.etron.info/verwaltungsoberflache/api-and-hooks/authentication.md).

# Authentication

> *API & Hooks -> Authentication*

<div data-with-frame="true"><figure><img src="/files/lZzsPcjcq82FQ228UQ1w" alt=""><figcaption><p>API &#x26; Hooks -> Authentication</p></figcaption></figure></div>

Diese Anleitung beschreibt die Einrichtung der OAuth2-Authentifizierung für die REST-API mithilfe von [Postman](https://www.postman.com/downloads/).

{% stepper %}
{% step %}

### Authentizierung in ETRON onRetail erstellen

> *API & Hooks -> Authentication*

1. Neue Authentifizierung anlegen
2. Folgende Einstellungen setzen:
   * **Name:** der Name des Drittprogramms
   * **Oauth Type:** Client Credentials
   * **User:** Benutzer, der für die API verwendet wird
3. Alle weiteren Felder unverändert lassen
4. Speichern<br>

   <div data-with-frame="true"><figure><img src="/files/9Iu6NVxRn4W9SEW6MnDc" alt=""><figcaption><p>Name, OAuth Type und User werden in diesem Screenshot gesetzt</p></figcaption></figure></div>

Die generierten Werte (**API Key** und **Secret**) werden für die API Plattform (z.B. Postman) benötigt.
{% endstep %}

{% step %}

### Collection in Postman vorbereiten

{% hint style="info" %}
*Bei Bestellung des ETRON onRetail REST API Moduls wird eine V2 Collection mit diversen Abfragen vom ETRON Support bereitgestellt.*
{% endhint %}

1. Collection importieren

   <div data-with-frame="true"><figure><img src="/files/mzDTy2wD5ZA7larhj7X0" alt=""><figcaption><p>So wird in Postman eine Collection importiert</p></figcaption></figure></div>
2. Collection öffnen
3. Reiter "Authorization" auswählen
4. **Type**: OAuth 2.0 setzen

   <div data-with-frame="true"><figure><img src="/files/4Yc67j8S2SnIglk480PV" alt=""><figcaption><p>Auth Type unter Authorization setzen</p></figcaption></figure></div>
5. Reiter "Variables" auswählen
6. Neue Variable anlegen:
   * Name: `base_url`
   * Current Value: URL der Instanz\
     Beispiel: `https://xxxxxx.wawi.onretail.eu`
7. Wichtig: Kein `/` am Ende der URL angeben

Optional:

* `client_id` und `client_secret` ebenfalls als Variablen hinterlegen und die Current Values mit dem API Key und Secret befüllen

<div data-with-frame="true"><figure><img src="/files/k7Ql2YX7pF6bR61xSCe9" alt=""><figcaption><p>Variablenübersicht im Postman</p></figcaption></figure></div>
{% endstep %}

{% step %}

### Access Token konfigurieren

1. In der Collection unter "Authorization" zu **Configure New Token** runterscrollen
2. Folgende Werte eintragen:
   * **Token Name:** frei wählbar\
     Beispiel: *ETRON onRetail Token*
   * **Grant Type:** Client Credentials
   * **Access Token URL:**\
     `{{base_url}}/api/v2/authentication/oauth2/token`
   * **Client ID:**\
     API Key aus ETRON onRetail\
     oder `{{client_id}}`
   * **Client Secret:**\
     Secret aus ETRON onRetail\
     oder `{{client_secret}}`
   * **Client Authentication:**\
     Send as Basic Auth header

<div data-with-frame="true"><figure><img src="/files/8RDA1qiOg2YBddSKmoT9" alt=""><figcaption><p>Neue Tokenkonfiguration</p></figcaption></figure></div>
{% endstep %}

{% step %}

### Access Token generieren

1. **Get New Access Token** auswählen
2. Token abrufen
3. Token verwenden (Use Token)
   {% endstep %}

{% step %}

### API-Abfragen durchführen

Nach erfolgreicher Authentifizierung können API-Abfragen durchgeführt werden.

* Verfügbare Abfragen unter\
  \&#xNAN;*API & Hooks → Endpunkte →* [*Documentation*](/verwaltungsoberflache/api-and-hooks/endpunkte/documentation-v2-rest-api-dokumentation.md)
* Beispielabfragen:\
  In der bereitgestellten **V2 Postman Collection** enthalten
  {% endstep %}
  {% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://helpcenter.etron.info/verwaltungsoberflache/api-and-hooks/authentication.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
