Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authorisation with Custom Headers in auth.json #10165

Open
rlees85 opened this issue Oct 15, 2021 · 3 comments
Open

Authorisation with Custom Headers in auth.json #10165

rlees85 opened this issue Oct 15, 2021 · 3 comments
Labels
Milestone

Comments

@rlees85
Copy link

rlees85 commented Oct 15, 2021

My composer.json:

{
    "config": {},
    "repositories": [{
        "type": "composer",
        "url": "https://secure.repo.url",
        "options":  {
            "http": {
                "header": [
                    "cf-access-token: <token>"
                ]
            }
        }
    }]
}

From the documentation here: https://getcomposer.org/doc/articles/authentication-for-private-packages.md#custom-token-authentication

It seems that there is no way to use this method of authentication securely. There is no way to define custom headers and tokens in auth.json. Additionally, repositories do not "merge" with the global composer file: so you cannot just define the secure repo in the project composer.json and then the authentication settings in the global one.

The only solution I have found so far is to not define the repository at all at the project level that does not seem ideal.

Composer configuration also does not support environment variables.

I noticed there is also a bearer auth method but only works if the Authorization header is required.

It seems like there should be a way of specifying secure/secret headers in auth.json.

@Seldaek Seldaek added this to the Nice To Have milestone Oct 16, 2021
@Radon8472
Copy link

Radon8472 commented Apr 1, 2022

Auth for the new changed github api has the same issue, you need to provide a Authorization: token YOUR_TOKEN header, what currently seems to be impossible via auth.json

@Seldaek
Copy link
Member

Seldaek commented Apr 1, 2022

@Radon8472 this should be possible via the github-oauth config option tho. If you have auth configured there it shuold be picked up automatically by all composer code.

@Radon8472
Copy link

@Radon8472 this should be possible via the github-oauth config option tho. If you have auth configured there it shuold be picked up automatically by all composer code.

I dont know why, but last month it was not working, now it seems that something has change on github, now github-oauth is woking again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants