How to use External Auth to pull down Github NPM packages?
HI! I'm experimenting with Coder right now how it hooks up with Github. I've got it connected into Github for user-authentication, as well as configured for external auth. We can spin up a workspace that checks out code using the
github_token
returned by the auth, and we've verified that the token then has access to other repositories that the user has access to. So far so good.
Where we're struggling now is using the same token to access Github's package repository (NPM). Here's what we've done so far:
1. Made sure the Github App has read:packages
permissions.
2. Set the CODER_EXTERNAL_AUTH_0_SCOPES
environment variable to repo workflow admin:public_key read:packages
(note, also tried with commas).
3. Verified that the scopes look good in https://... our endpoint/api/v2/deployment/config
4. Set up the ~/.npmrc
file:
When the workspace boots up and we try to log in:
When I check the Github Security Logs, it always lists token_scopes as empty for the tokens being generated... is there something else we need to do, or a bug?8 Replies
<#1360813680874360972>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
What happens if you manually do
npm login
And use the token provided by coder external-auth access-token github
?@Diranged
After digging for a while - and talking to Github - I discovered that the ONLY tokens that are allowed to make calls to their NPM service are PATs. Nothing else. No Github-App generated tokens. 😦
are you maybe able to create a PAT from that app token?
No - you cannot. 😦
Github simply doesn't support it... pretty terrible to be honest.
that kinda sucks
@Phorcys closed the thread.