git-resource icon indicating copy to clipboard operation
git-resource copied to clipboard

Accept Github Personal Access tokens as authorization

Open andrewedstrom opened this issue 6 years ago • 5 comments

Currently the only way to authenticate against github in this resource is with a user's private key. I would like to be able to authenticate with a Personal Access Token as well.

The github release resource already accepts an OAuth access token (as the parameter access_token), which can be used to pull and push to private repos. I would like to have that same field on my git-resources so that I can use the same token for authenticating with both resource types.

andrewedstrom avatar Mar 14 '18 19:03 andrewedstrom

It is already supported, the trick to set it as the 'password' parameter of the git-resource.

gamov avatar Nov 23 '18 09:11 gamov

Can we get that added to the readme?

andrewedstrom avatar Nov 25 '18 07:11 andrewedstrom

It is already supported, the trick to set it as the 'password' parameter of the git-resource.

this doesn't work in 5.8.0, the configure_credentials function in common.sh expects both username and password to be non-empty to create the .netrc file.

gdamjan avatar Mar 17 '20 16:03 gdamjan

sigh, this works:

username: ((github_apptoken))
password: x-oauth-basic

gdamjan avatar Mar 20 '20 18:03 gdamjan

sigh, this works:

username: ((github_apptoken))
password: x-oauth-basic

An update for anyone trying to use this today: The token is now expected to be in the password field, and the username field is ignored. (Above observed with github's new/experimental FGPATs, not the traditional course-grained access tokens; not sure whether it's true beyond them).

charles-dyfis-net avatar Nov 15 '22 23:11 charles-dyfis-net