Skip to content

Commit 3440909

Browse files
Update usage documentation for configuring authentication unattended (#173)
Related to #157
1 parent b7e1ea1 commit 3440909

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

GitHubConfiguration.ps1

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -836,13 +836,14 @@ function Set-GitHubAuthentication
836836
SecureString for use in future PowerShell sessions.
837837
838838
.EXAMPLE
839-
$secureString = ("<Your Access Token>" | ConvertTo-SecureString)
839+
$secureString = ("<Your Access Token>" | ConvertTo-SecureString -AsPlainText -Force)
840840
$cred = New-Object System.Management.Automation.PSCredential "username is ignored", $secureString
841841
Set-GitHubAuthentication -Credential $cred
842+
$secureString = $null # clear this out now that it's no longer needed
843+
$cred = $null # clear this out now that it's no longer needed
842844
843-
Uses the API token stored in the password field of the provided credential object for
844-
authentication, and stores it in a file on the machine as a SecureString for use in
845-
future PowerShell sessions.
845+
Allows you to specify your access token as a plain-text string ("<Your Access Token>")
846+
which will be securely stored on the machine for use in all future PowerShell sessions.
846847
847848
.EXAMPLE
848849
Set-GitHubAuthentication -SessionOnly

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ access token.
7171
securely cached to disk and will persist across all future PowerShell sessions.
7272
If you ever wish to clear it in the future, just call `Clear-GitHubAuthentication`).
7373

74+
> For automated scenarios (like GithHub Actions) where you are dynamically getting the access token
75+
> needed for authentication, refer to `Example 2` in `Get-Help Set-StoreBrokerAuthentication -Examples`
76+
> for how to configure in a promptless fashion.
77+
>
78+
> Alternatively, you _could_ configure PowerShell itself to always pass in a plain-text access token
79+
> to any command (by setting `$PSDefaultParameterValues["*-GitHub*:AccessToken"] = "<access token>"`),
80+
> although keep in mind that this is insecure (any other process could access this plain-text value).
81+
7482
A number of additional configuration options exist with this module, and they can be configured
7583
for just the current session or to persist across all future sessions with `Set-GitHubConfiguration`.
7684
For a full explanation of all possible configurations, run the following:

0 commit comments

Comments
 (0)