< Back

Get-GoogleOAuth2Token

Tue Jan 14, 2020 12:01 am

NAME Get-GoogleOAuth2Token



SYNOPSIS

Retrieves a current access token from the in-memory cache or local disk.





SYNTAX

Get-GoogleOAuth2Token [-ClientId] <String> [[-ProfileLocation] <String>] [-Persist] [<CommonParameters>]





DESCRIPTION

This cmdlet retrieves the token set for the specified ClientId, either from the in-memory cache

or the local disk if it is persisted. The access_token is analyzed to see if it is valid, and if not,

it is automatically updated if a refresh token and client secret is present or if the client id

specifies a service account profile, if the iss, scope, and client secret properties are present.





PARAMETERS

-ClientId <String>

The key value the token set is stored as.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-ProfileLocation <String>

The location where stored credentials are located. If this is not specified, the default location will be used.



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Persist [<SwitchParameter>]

Specifies that if the access token needs to be refreshed during retrieval that the updated access token is

persisted to disk.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String





OUTPUTS

System.Collections.Hashtable





NOTES





AUTHOR: Michael Haken

LAST UPDATE: 1/18/2018



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



PS C:\\>$Token = Get-GoogleOAuth2Token -ClientId $Id -Persist



This example retrieves the stored tokens and client secret associated with the provided client Id and persists the

updated

access token if it needs to be refreshed.











RELATED LINKS