Get-GitHubUserAuthenticated
SYNOPSIS
Get the authenticated user
SYNTAX
__AllParameterSets
Get-GitHubUserAuthenticated [-Accept <string>]
ALIASES
This cmdlet has the following aliases,
- Get-GHUserAuthenticated
DESCRIPTION
The Get-GitHubUserAuthenticated cmdlet invokes the GET method of the /user endpoint (Get the authenticated user)
OAuth app tokens and personal access tokens (classic) need the ‘read:user’ scope, or the broader ‘user’ scope, for this endpoint to return the private user response. The private user response includes additional fields such as ‘private_gists’, ‘total_private_repos’, ‘owned_private_repos’, ‘disk_usage’, ‘collaborators’, and ‘two_factor_authentication’. Tokens without these scopes receive the public user response.
The private and public user response types are unrelated to the private profile (https://docs.github.com/account-and-profile/concepts/personal-profile#private-profiles) setting. A token without scopes still authenticates as the token’s owner, so values subject to private profile visibility, such as ‘followers’ and ‘following’, may differ from an unauthenticated response.
For enterprise-managed users, if their email is unverified, this endpoint will return a placeholder email in the format ‘email+shortcode@domain.com’ instead of their actual email. This placeholder email may cause issues with some third-party apps (https://github.blog/changelog/2024-08-01-enterprise-managed-user-accounts-now-require-email-verification/). Once the user has verified their email address (https://docs.github.com/account-and-profile/how-tos/email-preferences/verifying-your-email-address), the endpoint will return their real email.
Endpoint: GET /user API version: 2026-03-10
EXAMPLES
EXAMPLE 1
Get-GitHubUserAuthenticated
Invokes GET /user
PARAMETERS
-Accept
The Accept header (media type) of the request Default value: application/vnd.github+json
Type: System.String
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
Objects with properties named like the path parameters can be piped to this function
{{ Fill in the Description }}
OUTPUTS
The response of the GitHub API (objects
{{ Fill in the Description }}
NOTES
OperationId: users/get-authenticated Category: users / users Not enabled for GitHub Apps