Skip to content

Get-GitHubAccessToken

SYNOPSIS

Retrieves the GitHub access token from the specified context.

SYNTAX

Get access token as SecureString (Default)

Get-GitHubAccessToken [-Context <Object>] [<CommonParameters>]

Get access token as plain text

Get-GitHubAccessToken -AsPlainText [-Context <Object>] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

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: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: Get access token as plain text
  Position: Named
  IsRequired: true
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-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: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: Named
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Security.SecureString

{{ Fill in the Description }}

System.String

{{ Fill in the Description }}

NOTES