Get-GitHubAccessToken¶
SYNOPSIS¶
Retrieves the GitHub access token from the specified context.
SYNTAX¶
Get access token as SecureString (Default)¶
Get-GitHubAccessToken [-Context <Object>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
Get access token as plain text¶
Get-GitHubAccessToken [-AsPlainText] [-Context <Object>] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
DESCRIPTION¶
Returns the access token from the provided context. If the -AsPlainText switch is specified, the token is returned as a plain text string; otherwise, the original secure string or string value is returned as stored in the context. Use this function to extract authentication tokens for subsequent API requests.
EXAMPLES¶
EXAMPLE 1¶
Get-GitHubAccessToken
Output:
System.Security.SecureString
Retrieves the access token from the default context as a secure string.
EXAMPLE 2¶
Get-GitHubAccessToken -Context $myGitHubContext -AsPlainText
Output:
ghp_exampletoken1234567890
Retrieves the access token from a specified context as a plain text string.
PARAMETERS¶
-AsPlainText¶
If specified, the token will be returned as plain text.
Type: SwitchParameter
Parameter Sets: Get access token as plain text
Aliases:
Required: True
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Context¶
The context to run the command in. Used to get the details for the API call. Can be either a string or a GitHubContext object.
Type: Object
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction¶
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters¶
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.