Get-PnPAppAuthAccessToken

Returns the access token

Syntax

Get-PnPAppAuthAccessToken
   [-Connection <SPOnlineConnection>]

Description

Returns the access token from the current client context (only works with App-Only authentication)

Examples

------------------EXAMPLE 1------------------

$accessToken = Get-PnPAppAuthAccessToken

This will put the access token from current context in the $accessToken variable. Will only work in App authentication flow (App+user or App-Only)

Parameters

-Connection

Optional connection to be used by the cmdlet. Retrieve the value for this parameter by either specifying -ReturnConnection on Connect-PnPOnline or by executing Get-PnPConnection.

Type:SPOnlineConnection
Position:Named
Accept pipeline input:False
Accept wildcard characters:False

Outputs

System.String