Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/functions/public/Auth/Connect-GitHubAccount.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@
)]
[switch] $UseAccessToken,

# An access token to use for authentication.
# An access token to use for authentication. Can be both a string or a SecureString.
# Supports both personal access tokens (PAT) and GitHub App installation access tokens (IAT).
# Example: 'ghp_1234567890abcdef'
# Example: 'ghs_1234567890abcdef'
[Parameter(
Mandatory,
ParameterSetName = 'Token'
)]
[string] $Token,
[object] $Token,

# The client ID for the GitHub App to use for authentication.
[Parameter(ParameterSetName = 'UAT')]
Expand Down Expand Up @@ -133,6 +133,10 @@
[switch] $Silent
)
try {
if ($Token -is [System.Security.SecureString]) {
$Token = ConvertFrom-SecureString $Token -AsPlainText
}

$HostName = $HostName -replace '^https?://'
$ApiBaseUri = "https://api.$HostName"
$authType = $PSCmdlet.ParameterSetName
Expand Down