FriendsOfShopware / packages

Shopware Composer Repository
https://packages.friendsofshopware.com
MIT License
19 stars 7 forks source link

Bearer Token Keeps Rotating #210

Closed dfsoeten closed 3 years ago

dfsoeten commented 3 years ago

Whenever I reload the account page, the bearer token keeps rotating. This results in the following error:

$ composer require store.shopware.com/molliepayments
Warning from packages.friendsofshopware.com: Invalid access token
Warning from packages.friendsofshopware.com: Invalid access token
Warning from packages.friendsofshopware.com: Invalid access token

  [Composer\Downloader\TransportException]                                                                                      
  The "https://packages.friendsofshopware.com/packages.json" file could not be downloaded (HTTP/1.1 500 Internal Server Error)  

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

What is going on here?

shyim commented 3 years ago

Hey,

that's normal as it's not a real bearer token. It's generated with OpenSSL.

That error is thrown when the token is empty or invalid. https://github.com/FriendsOfShopware/packages/blob/e2bd9c4c4bf7cb21c121bdbb4496230726f6f44f/src/Components/RequestContextResolver.php#L23

Did you created the auth.json?

dfsoeten commented 3 years ago

Hey, thanks for your swift reply.

I did the following:

  1. Went to the Friends Of Shopware account page
  2. Clicked "Setup Repository in Project"
  3. Clicked "Copy config" (the second one)
  4. Created a auth.json in the same directory as my composer.json:
    {
    "bearer": {
        "packages.friendsofshopware.com": "<token here>"
    }
    }
  5. Rebuilt my Docker container to include the configured auth.json
  6. Ran composer require store.shopware.com/molliepayments inside my container I've verified that auth.json exists inside my container

Result:

$ tree -L 1 -P 'composer.*|auth.json'
.
├── artifacts
├── auth.json
├── bin
├── composer.json
├── composer.lock
├── config
├── custom
├── files
├── public
├── src
├── var
└── vendor

The repository section inside my composer.json looks like this:

"repositories": [
    {
        "type": "path",
        "url": "custom/static-plugins/*",
        "options": {
            "symlink": true
        }
    },
    {
        "type": "composer",
        "url": "https://packages.friendsofshopware.com/"
    }
]
shyim commented 3 years ago

Which Composer version are you using?

dfsoeten commented 3 years ago
$ composer --version
Composer version 1.8.6 2019-06-11 15:03:05
shyim commented 3 years ago

Thats pretty old. Can you update to an newer one?

dfsoeten commented 3 years ago

That solved my issue, thanks!