File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -836,13 +836,14 @@ function Set-GitHubAuthentication
836
836
SecureString for use in future PowerShell sessions.
837
837
838
838
. EXAMPLE
839
- $secureString = ("<Your Access Token>" | ConvertTo-SecureString)
839
+ $secureString = ("<Your Access Token>" | ConvertTo-SecureString -AsPlainText -Force )
840
840
$cred = New-Object System.Management.Automation.PSCredential "username is ignored", $secureString
841
841
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
842
844
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.
846
847
847
848
. EXAMPLE
848
849
Set-GitHubAuthentication -SessionOnly
Original file line number Diff line number Diff line change @@ -71,6 +71,14 @@ access token.
71
71
securely cached to disk and will persist across all future PowerShell sessions.
72
72
If you ever wish to clear it in the future, just call ` Clear-GitHubAuthentication ` ).
73
73
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
+
74
82
A number of additional configuration options exist with this module, and they can be configured
75
83
for just the current session or to persist across all future sessions with ` Set-GitHubConfiguration ` .
76
84
For a full explanation of all possible configurations, run the following:
You can’t perform that action at this time.
0 commit comments