Get-PnPAccessToken

Tip

We encourage you to make improvements to this documentation. Please navigate to https://github.com/pnp/powershell/blob/dev/documentation/Get-PnPAccessToken.md to change this file.

Returns the current Microsoft Graph OAuth Access token

Syntax

Get-PnPAccessToken
   [-Decoded]
   [<CommonParameters>]

Description

Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API. Doesn't work with all Connect-PnPOnline options. To retrieve the SharePoint Online access token, instead use Get-PnPAppAuthAccessToken.

Examples

EXAMPLE 1

Get-PnPAccessToken

Gets the OAuth 2.0 Access Token to consume the Microsoft Graph API

Parameters

-Decoded

Returns the details from the access token in a decoded manner

Type:SwitchParameter
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False