Cannot use GitLab private token for authorization
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.
It is not supposed to be in this file.
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).
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"
]
}
}
}
]
}
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.
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.
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
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.
There you go :)
https://github.com/composer/satis/pull/396