< Back
Set-GoogleOAuth2Profile
Post
NAME Set-GoogleOAuth2Profile
SYNOPSIS
Sets the data in a profile.
SYNTAX
Set-GoogleOAuth2Profile -ClientId <String> [-ClientSecret <String>] [-AccessToken <String>] [-RefreshToken
<String>] [-ProfileLocation <String>] [-Persist] [<CommonParameters>]
Set-GoogleOAuth2Profile -ClientSecret <String> [-AccessToken <String>] -ServiceAccountEmail <String> [-Audience
<String>] [-Subject <String>] [-ValidityInSeconds <Int32>] [-ProfileLocation <String>] [-Persist]
[<CommonParameters>]
Set-GoogleOAuth2Profile -AccessToken <String> -ServiceAccountEmail <String> [-ProfileLocation <String>] [-Persist]
[<CommonParameters>]
DESCRIPTION
This cmdlet sets data for a specified ClientId profile. The profiles support both OAuth Clients and Service Account
based credentials. For client credentials, you must specify either an access token or refresh token. If you specify
a refresh token, you should also specify the client secret so the token can be refreshed.
For a service account, you can store either an existing access token, or the service account private key and
details to construct a JWT which can be exchanged for an access token.
PARAMETERS
-ClientId <String>
The profile Id to store the data with, this can be an OAuth2 Client Profile or a Service Account ClientId.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ClientSecret <String>
The provided client secret associated with the ClientId. This can be the OAuth2 provided client secret or a
private key
from a service account.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-AccessToken <String>
The access token to store in the profile.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RefreshToken <String>
The refresh token to store in the profile when using client based OAuth.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ServiceAccountEmail <String>
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Audience <String>
Required? false
Position? named
Default value https://www.googleapis.com/oauth2/v4/token
Accept pipeline input? false
Accept wildcard characters? false
-Subject <String>
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ValidityInSeconds <Int32>
Required? false
Position? named
Default value 0
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? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Persist [<SwitchParameter>]
Specifies if the data should be persisted to disk in an encrytped format or only maintained in the local 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
None
NOTES
AUTHOR: Michael Haken
LAST UPDATE: 1/17/2018
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Set-GoogleOAuth2Profile -ClientId $Id -ClientSecret $Secret -AccessToken $Token -RefreshToken $RToken
-Persist
This example stores the client secret, current access token, and refresh token to the local cache and persists
them to disk.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Set-GoogleOAuth2Profile -ClientId $Id -ClientSecret $Secret -RefreshToken $RToken -Persist
This example stores the client secret and refresh token to the local cache and persists them to disk. Because only
a refresh token
is stored, the next time the token in this profile is accessed, a new access token will be retrieved with the
stored refresh token.
RELATED LINKS
SYNOPSIS
Sets the data in a profile.
SYNTAX
Set-GoogleOAuth2Profile -ClientId <String> [-ClientSecret <String>] [-AccessToken <String>] [-RefreshToken
<String>] [-ProfileLocation <String>] [-Persist] [<CommonParameters>]
Set-GoogleOAuth2Profile -ClientSecret <String> [-AccessToken <String>] -ServiceAccountEmail <String> [-Audience
<String>] [-Subject <String>] [-ValidityInSeconds <Int32>] [-ProfileLocation <String>] [-Persist]
[<CommonParameters>]
Set-GoogleOAuth2Profile -AccessToken <String> -ServiceAccountEmail <String> [-ProfileLocation <String>] [-Persist]
[<CommonParameters>]
DESCRIPTION
This cmdlet sets data for a specified ClientId profile. The profiles support both OAuth Clients and Service Account
based credentials. For client credentials, you must specify either an access token or refresh token. If you specify
a refresh token, you should also specify the client secret so the token can be refreshed.
For a service account, you can store either an existing access token, or the service account private key and
details to construct a JWT which can be exchanged for an access token.
PARAMETERS
-ClientId <String>
The profile Id to store the data with, this can be an OAuth2 Client Profile or a Service Account ClientId.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ClientSecret <String>
The provided client secret associated with the ClientId. This can be the OAuth2 provided client secret or a
private key
from a service account.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-AccessToken <String>
The access token to store in the profile.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-RefreshToken <String>
The refresh token to store in the profile when using client based OAuth.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ServiceAccountEmail <String>
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Audience <String>
Required? false
Position? named
Default value https://www.googleapis.com/oauth2/v4/token
Accept pipeline input? false
Accept wildcard characters? false
-Subject <String>
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-ValidityInSeconds <Int32>
Required? false
Position? named
Default value 0
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? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Persist [<SwitchParameter>]
Specifies if the data should be persisted to disk in an encrytped format or only maintained in the local 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
None
NOTES
AUTHOR: Michael Haken
LAST UPDATE: 1/17/2018
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Set-GoogleOAuth2Profile -ClientId $Id -ClientSecret $Secret -AccessToken $Token -RefreshToken $RToken
-Persist
This example stores the client secret, current access token, and refresh token to the local cache and persists
them to disk.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Set-GoogleOAuth2Profile -ClientId $Id -ClientSecret $Secret -RefreshToken $RToken -Persist
This example stores the client secret and refresh token to the local cache and persists them to disk. Because only
a refresh token
is stored, the next time the token in this profile is accessed, a new access token will be retrieved with the
stored refresh token.
RELATED LINKS