# Beispielaufruf ohne Plugin

**URL:** <https://forum.shopware.com/t/beispielaufruf-ohne-plugin/66760>\
**Category:** Shopware Playground - API first Sandbox\
**Created:** [6. Mai 2020 um 10:03 UTC](https://forum.shopware.com/t/beispielaufruf-ohne-plugin/66760 "2020-05-06T10:03:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jungblut](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@jungblut](https://forum.shopware.com/u/jungblut)\
**Post date:** [6. Mai 2020 um 10:03 UTC](https://forum.shopware.com/t/beispielaufruf-ohne-plugin/66760/1 "2020-05-06T10:03:16Z")

</div>

Hallo,

ich würde gerne etwas Entwickeln, was Daten von einem ERP System in den Shop lädt (und umgekehrt).  
Bei Shopware 5: Alles Easy Peasy.

Ich mach das ganze, wie bei meinem SW5 Connector auch, ohne Plugin.  
Auch wenn das Beispiel ein Plugin ist, wird es ja von SW direkt empfohlen, nicht in ein Plugin zu packen  
Siehe : [https://docs.shopware.com/en/shopware-platform-dev-en/how-to/working-with-the-api-and-an-http-client](https://docs.shopware.com/en/shopware-platform-dev-en/how-to/working-with-the-api-and-an-http-client)  
(Das finde ich auch gut so…)

> Warning
> 
> For reasons of simplicity we wrote a Shopware 6 plugin, but in most cases this is not a good use case. Please do not call the Shopware 6 API through a plugin unless you do have a really good reason to do so!

Das ist ja alles schön und gut, ich habe aber im Backend eine neue Integration anlegegt.  
(Das ist ein Lokaler Demoshop, das sind keine Produktiven Zugangsdaten)

[https://drive.google.com/file/d/1aVRvbug-RbOFSDdq5GdfK3Sa1rmN1Vqe/view](https://drive.google.com/file/d/1aVRvbug-RbOFSDdq5GdfK3Sa1rmN1Vqe/view)  
[https://drive.google.com/file/d/17JzkKBCjqCs18ppGeLgD5FrQfNYwjjE5/view](https://drive.google.com/file/d/17JzkKBCjqCs18ppGeLgD5FrQfNYwjjE5/view)

Und das ist mein Quellcode. Eine kurze Zusammenfassung aus dem Beispiel:

```
 'Test',
    'grant_type' => 'password',
    'scopes' => 'write',
    'username' => "SWIACTDJR1FMU1DWDDRNSLJUVG",
    'password' => "WmhuSXZaSkJSUzh0bndYUHo4YzdSMUVhSVhsUUxYYWM5b1hGOHM"
]);

$request = new Request(
    'POST',
    'localhost/intosshop/public/api/oauth/token',
    ['Content-Type' => 'application/json'],
    $body
);

$response = $client->send($request);
var_dump($response);

?>

```

Und das ist die Fehlermeldung die ich erhalte:

> **Fatal error** : Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST localhost/intosshop/public/api/oauth/token` resulted in a `401 Unauthorized` response: {„errors“:[{„code“:„4“,„status“:„401“,„title“:„Client authentication failed“,„detail“:null}]} in /Applications/MAMP/htdocs/sw6interface/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113 Stack trace: #0 /Applications/MAMP/htdocs/sw6interface/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response)) #1 /Applications/MAMP/htdocs/sw6interface/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp{closure}(Object(GuzzleHttp\Psr7\Response)) #2 /Applications/MAMP/htdocs/sw6interface/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array) #3 /Applications/MAMP/htdocs/sw6interface/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promi in **/Applications/MAMP/htdocs/sw6interface/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php** on line **113**

Ich bin mir zu 1000% sicher, dass das eine Zeile ist oder ein Wort oder ein was auch immer ist, was angepasst werden soll / muss, damit zumindest die Authentifizierung fruchtet.  
Im Forum hab ich so auf die schnelle nichts gefunden.

Kann mir jemand helfen?

Vielen Dank!
