satis icon indicating copy to clipboard operation
satis copied to clipboard

Cannot use GitLab private token for authorization

Open andkirby opened this issue 9 years ago • 8 comments

According to documentation about using token in headers I cannot use my token.

Please take a look my issue https://github.com/composer/composer/pull/3765#issuecomment-245612489

my configuration doesn't work:

{
  "name": "MySatis",
  "homepage": "http://satis.example.com/",
  "repositories": [
    {
      "url": "https://git.example.com/foo/bar.git",
      "type": "gitlab",
      "options":  {
        "http": {
          "header": [
            "PRIVATE-TOKEN: QWEQWEQWEQWE"
          ]
        }
      }
    }
  ],
  "require-all": true,
  "output-dir": "html"
}

The options wasn't passed to the code.

andkirby avatar Sep 08 '16 14:09 andkirby

It is not supposed to be in this file.

alcohol avatar Sep 09 '16 05:09 alcohol

Try running:

composer config -g gitlab-oauth.<gitlab_domain> <oauth_token>

replace <gitlab_domain> with the full domain (including subdomain) to your repository. replace <oauth_token> with a valid oauth token (not personal access token).

alcohol avatar Sep 09 '16 06:09 alcohol

Thanks for answer. Ok, it's a bit clear about OAuth.

But about this config from documentation. Where it suppose to be? Why I cannot use it for adding a private token for authorization?

{
    "repositories": [
        {
            "type": "composer",
            "url": "https://example.org",
            "options":  {
                "http": {
                    "header": [
                        "API-TOKEN: YOUR-API-TOKEN"
                    ]
                }
            }
        }
    ]
}

andkirby avatar Sep 09 '16 07:09 andkirby

Because that documentation is for using Satis from within a Composer project. It is not about configuration for Satis itself. The options array is supported by the repository type composer (your Satis instance). It is not supported by the gitlab repository type.

alcohol avatar Sep 09 '16 09:09 alcohol

Composer has a 'gitlab' repository type that works along 'gitlab-token' and 'gitlab-domains' config options. (oAuth cannot be used with 2FA)

This doesn't work with satis. When building, satis asks for username/password.

laurentdinclaux avatar Jan 29 '17 07:01 laurentdinclaux

Satis is locked to version 1.2.1 of composer but Gitlab private tokens support is available since 1.3 only

The solution is to cd to satis directory and do composer update composer/composer

laurentdinclaux avatar Jan 29 '17 07:01 laurentdinclaux

Satis is not explicitly locked to 1.2.1. It has a constraint that allows higher versions. We just don't update the lock file unless there are other changes as well. You can always run update yourself. If you feel that this fixes a particular problem, simply submit a PR for the updated lock file.

alcohol avatar Jan 30 '17 07:01 alcohol

There you go :)

https://github.com/composer/satis/pull/396

pinfake avatar Feb 17 '17 12:02 pinfake