pcgeek86 / PSGitHub

This PowerShell module contains commands to manage GitHub through its REST API.
MIT License
186 stars 37 forks source link

Set-GitHubToken doesn't work on macOS/Linux #44

Closed felixfbecker closed 6 years ago

felixfbecker commented 6 years ago

PowerShell credential request Please enter your GitHub username and Personal Access Token. Visit https://github.com/settings/tokens to obtain a Personal Access Token. Password for user :


I guess on Windows it acted more like a placeholder value?
felixfbecker commented 6 years ago

@pcgeek86 so I am trying to make Set-GitHubToken work cross-platform and it turns out that ConvertFrom-SecureString is not available on Linux/macOS and won't be, maybe ever: https://github.com/PowerShell/PowerShell/issues/1654

So it's impossible on Linux/macOS to store an intransparently-encrypted version of the token on disk. On macOS maybe you could put it in the keychain.

So instead of forcing a decision on the user to store the token in plaintext, I would propose shifting that decision to the user by taking -Token on every function and letting them use $PSDefaultParameterValues - then every user can decide how they want to store it, they just need to set it in their profile.ps1.

johlju commented 6 years ago

@felixfbecker I like that idea of using -Token. Maybe keep the old behavior if -Token is not provided, to prevent a breaking change? But -Token will be a requirement for Linux/macOS and should throw if not provided?