< Back

Convert-GoogleOAuth2JWT

Tue Jan 14, 2020 12:00 am

NAME Convert-GoogleOAuth2JWT



SYNOPSIS

Converts a GCP service account JWT for an access token.





SYNTAX

Convert-GoogleOAuth2JWT [-JWT] <String> [-ClientId] <String> [[-ProfileLocation] <String>] [-Persist]

[<CommonParameters>]





DESCRIPTION

This cmdlet takes a constructed JWT generated from a GCP Service Account credentials and exchanges

it for an access token which can be used to authorize subsequent calls to Google APIs.





PARAMETERS

-JWT <String>

The base64url encoded JWT generated from the GCP service account credentials.



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-ClientId <String>

The service account email address.



Required? true

Position? 2

Default value

Accept pipeline input? false

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? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Persist [<SwitchParameter>]

Indicates that the retrieved access token will be persisted on disk in an encrypted

format using the Windows DPAPI as well as the local in-memory cache (also encrypted).



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

None





OUTPUTS

System.Collections.Hashtable





NOTES





AUTHOR: Michael Haken

LAST UPDATE: 1/27/2018



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



PS C:\\>$Token = Convert-GoogleOAuth2JWT -JWT $JWT -ClientId "test-sa@my-project.iam.gserviceaccount.com"



Converts the constructed JWT to a token object whose access token can be used to call other APIs.











RELATED LINKS