# Error while authentification with the Shopware Account Test-Instance

**URL:** https://forum.shopware.com/t/error-while-authentification-with-the-shopware-account-test-instance/95892
**Category:** Shopware Cloud
**Tags:** programming
**Created:** [22. August 2022 um 06:11 UTC](https://forum.shopware.com/t/error-while-authentification-with-the-shopware-account-test-instance/95892 "2022-08-22T06:11:12Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![r.codegiganten](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@r.codegiganten](https://forum.shopware.com/u/r.codegiganten)
#### Post date: [22. August 2022 um 06:11 UTC](https://forum.shopware.com/t/error-while-authentification-with-the-shopware-account-test-instance/95892/1 "2022-08-22T06:11:12Z")

</div>

Hello to everybody,

we got some problem with the Shopware [AppTemplate] ([GitHub - shopware/AppTemplate](https://github.com/shopware/AppTemplate)) and the Shopware 6 Test-Instance (The instance to test bevor you give an App to the Review).

When trying to authenticate with the Shopware 6 app test environment to send a request to the Shopware instance, the core code of the AppTemplate throws an exception. This is thrown by a 302 Http status code:

```auto
GuzzleHttp\Psr7\Response^ {#160
  -reasonPhrase: "Found"
  -statusCode: 302
  -headers: array:6 [
    "Content-Length" => array:1 [
      0 => "138"
    ]
    "Content-Type" => array:1 [
      0 => "text/html"
    ]
    "Date" => array:1 [
      0 => "Fri, 19 Aug 2022 13:16:47 GMT"
    ]
    "Location" => array:1 [
      0 => "http://xxx-dxifv.sw-testenvironment.de/shop/public/"
    ]
    "Server" => array:1 [
      0 => "nginx"
    ]
    "Vary" => array:1 [
      0 => "Accept-Encoding"
    ]
  ]
  -headerNames: array:6 [
    "content-length" => "Content-Length"
    "content-type" => "Content-Type"
    "date" => "Date"
    "location" => "Location"
    "server" => "Server"
    "vary" => "Vary"
  ]
  -protocol: "1.1"
  -stream: GuzzleHttp\Psr7\Stream^ {#156
    -stream: stream resource {@242
      wrapper_type: "PHP"
      stream_type: "TEMP"
      mode: "w+b"
      unread_bytes: 0
      seekable: true
      uri: "php://temp"
      options: []
    }
    -size: null
    -seekable: true
    -readable: true
    -writable: true
    -uri: "php://temp"
    -customMetadata: []
  }
}

```

```auto
PHP Warning: Trying to access array offset on value of type null in /vendor/shopware/app-bundle/src/Client/Credentials.php on line 22
PHP Warning: Trying to access array offset on value of type null in /vendor/shopware/app-bundle/src/Client/Credentials.php on line 23

TypeError {#163
  #message: "Shopware\AppBundle\Client\Credentials::__construct(): Argument #1 ($tokenType) must be of type string, null given, called in /vendor/shopware/app-bundle/src/Client/Credentials.php on line 23"
  #code: 0
  #file: "./vendor/shopware/app-bundle/src/Client/Credentials.php"
  #line: 9
  trace: {
    ./vendor/shopware/app-bundle/src/Client/Credentials.php:9 { …}
    ./vendor/shopware/app-bundle/src/Client/Credentials.php:23 { …}
    ./vendor/shopware/app-bundle/src/Client/ShopClient.php:94 { …}
    ./vendor/shopware/app-bundle/src/Client/ShopClient.php:70 { …}
    ./vendor/shopware/app-bundle/src/Client/ShopClient.php:32 { …}
    ./src/Helper/ShopFunctions.php:45 {
      App\Helper\ShopFunctions::getCurrencies(ShopClient $client)^
      › 'api/search/currency',
      › body: json_encode([])
      › ));
    }
    ./src/Command/DiscountCommand.php:55 { …}
    ./vendor/symfony/console/Command/Command.php:299 { …}
    ./vendor/symfony/console/Application.php:1006 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:96 { …}
    ./vendor/symfony/console/Application.php:295 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:82 { …}
    ./vendor/symfony/console/Application.php:167 { …}
    ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:56 { …}
    ./vendor/autoload_runtime.php:35 { …}
    ./bin/console_2:11 { …}
  }

```

The calling code:

```auto
static function getCurrencies(ShopClient $client)
    {
        $currencyResponse = $client->sendRequest(new Request(
            'POST',
            'api/search/currency',
            body: json_encode([])
        ));

        return json_decode($currencyResponse->getBody()->getContents(), true);
}

```

We already opened an issue at Github:

> <https://github.com/shopware/AppTemplate/issues/15>
>
> Hi everybody,
> 
> when trying to authenticate with the Shopware 6 app test enviro…nment to send a request to the Shopware instance, the core code throws an exception. This is thrown by a 302 Http status code: 
> 
> \`\`\`
> GuzzleHttp\\Psr7\\Response^ {#160
> -reasonPhrase: "Found"
> -statusCode: 302
> -headers: array:6 \[
> "Content-Length" =\> array:1 \[
> 0 =\> "138"
> \]
> "Content-Type" =\> array:1 \[
> 0 =\> "text/html"
> \]
> "Date" =\> array:1 \[
> 0 =\> "Fri, 19 Aug 2022 13:16:47 GMT"
> \]
> "Location" =\> array:1 \[
> 0 =\> "http://xxx-dxifv.sw-testenvironment.de/shop/public/"
> \]
> "Server" =\> array:1 \[
> 0 =\> "nginx"
> \]
> "Vary" =\> array:1 \[
> 0 =\> "Accept-Encoding"
> \]
> \]
> -headerNames: array:6 \[
> "content-length" =\> "Content-Length"
> "content-type" =\> "Content-Type"
> "date" =\> "Date"
> "location" =\> "Location"
> "server" =\> "Server"
> "vary" =\> "Vary"
> \]
> -protocol: "1.1"
> -stream: GuzzleHttp\\Psr7\\Stream^ {#156
> -stream: stream resource {@242
> wrapper\_type: "PHP"
> stream\_type: "TEMP"
> mode: "w+b"
> unread\_bytes: 0
> seekable: true
> uri: "php://temp"
> options: \[\]
> }
> -size: null
> -seekable: true
> -readable: true
> -writable: true
> -uri: "php://temp"
> -customMetadata: \[\]
> }
> }
> \`\`\`
> 
> 
> \`\`\`
> PHP Warning: Trying to access array offset on value of type null in /vendor/shopware/app-bundle/src/Client/Credentials.php on line 22
> PHP Warning: Trying to access array offset on value of type null in /vendor/shopware/app-bundle/src/Client/Credentials.php on line 23
> 
> TypeError {#163
> #message: "Shopware\\AppBundle\\Client\\Credentials::\_\_construct(): Argument #1 ($tokenType) must be of type string, null given, called in /vendor/shopware/app-bundle/src/Client/Credentials.php on line 23"
> #code: 0
> #file: "./vendor/shopware/app-bundle/src/Client/Credentials.php"
> #line: 9
> trace: {
> ./vendor/shopware/app-bundle/src/Client/Credentials.php:9 { …}
> ./vendor/shopware/app-bundle/src/Client/Credentials.php:23 { …}
> ./vendor/shopware/app-bundle/src/Client/ShopClient.php:94 { …}
> ./vendor/shopware/app-bundle/src/Client/ShopClient.php:70 { …}
> ./vendor/shopware/app-bundle/src/Client/ShopClient.php:32 { …}
> ./src/Helper/ShopFunctions.php:45 {
> App\\Helper\\ShopFunctions::getCurrencies(ShopClient $client)^
> › 'api/search/currency',
> › body: json\_encode(\[\])
> › ));
> }
> ./src/Command/DiscountCommand.php:55 { …}
> ./vendor/symfony/console/Command/Command.php:299 { …}
> ./vendor/symfony/console/Application.php:1006 { …}
> ./vendor/symfony/framework-bundle/Console/Application.php:96 { …}
> ./vendor/symfony/console/Application.php:295 { …}
> ./vendor/symfony/framework-bundle/Console/Application.php:82 { …}
> ./vendor/symfony/console/Application.php:167 { …}
> ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:56 { …}
> ./vendor/autoload\_runtime.php:35 { …}
> ./bin/console\_2:11 { …}
> }
> \`\`\`
> 
> 
> The calling code:
> \`\`\`
> static function getCurrencies(ShopClient $client)
> {
> $currencyResponse = $client-\>sendRequest(new Request(
> 'POST',
> 'api/search/currency',
> body: json\_encode(\[\])
> ));
> 
> return json\_decode($currencyResponse-\>getBody()-\>getContents(), true);
> }
> \`\`\`
> 
> Thanks for looking at

Thanks for looking at!
