New-PodeAuthOAuth2Scheme
SYNOPSIS
Creates a new OAuth2 Authentication Scheme.
SYNTAX
New-PodeAuthOAuth2Scheme [[-Realm] <String>] [-ClientId] <String> [[-ClientSecret] <String>]
[[-RedirectUrl] <String>] [[-AuthoriseUrl] <String>] [-TokenUrl] <String> [[-UserUrl] <String>]
[[-UserUrlMethod] <String>] [[-CodeChallengeMethod] <String>] [[-Scope] <String[]>] [[-Description] <String>]
[[-Middleware] <Object[]>] [[-InnerScheme] <Hashtable>] [-UsePKCE] [-ProgressAction <ActionPreference>]
[<CommonParameters>]
DESCRIPTION
Creates a new OAuth2 Authentication Scheme.
EXAMPLES
EXAMPLE 1
$scheme = New-PodeAuthOAuth2Scheme -ClientId 'my_client_id' -ClientSecret 'my_client_secret' -AuthoriseUrl 'https://example.com/oauth2/authorize' -TokenUrl 'https://example.com/oauth2/token' -UserUrl 'https://example.com/oauth2/userinfo'
EXAMPLE 2
$scheme = New-PodeAuthOAuth2Scheme -ClientId 'my_client_id' -AuthoriseUrl 'https://example.com/oauth2/authorize' -TokenUrl 'https://example.com/oauth2/token' -UserUrl 'https://example.com/oauth2/userinfo' -UsePKCE
PARAMETERS
-AuthoriseUrl
The Authorise URL to authenticate a user and obtain an Authorisation Code. This is optional if you're using an InnerScheme, such as Basic/Form authentication, which will use the Password Grant Type instead.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ClientId
The Client/Application ID for the OAuth2 application, usually supplied during the app registration process.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ClientSecret
The Client/Application secret for the OAuth2 application, usually supplied during the app registration process. This is optional when using PKCE.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-CodeChallengeMethod
An optional Code Challenge Method to use, when calling the Authorise URL, when using PKCE. (Default: S256)
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 9
Default value: S256
Accept pipeline input: False
Accept wildcard characters: False
-Description
An optional short description for Authentication Scheme. CommonMark syntax MAY be used for rich text representation.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 11
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-InnerScheme
An optional Authentication Scheme (such as New-PodeAuthBasicScheme) that will be called prior to this Scheme.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: False
Position: 13
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Middleware
An optional array of Middleware ScriptBlocks to run before the Scheme's scriptblock.
Type: Object[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 12
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ProgressAction
{{ Fill ProgressAction Description }}
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Realm
An optional Realm to use. (Default: User)
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: User
Accept pipeline input: False
Accept wildcard characters: False
-RedirectUrl
An optional Redirect URL (Default: \<host>/oauth2/callback)
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Scope
An optional array of scopes to request during the OAuth2 authentication process.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 10
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-TokenUrl
The Token URL to exchange an Authorisation Code for an Access Token, or to obtain an Access Token using the Password Grant Type.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-UsePKCE
Indicates whether to use PKCE (Proof Key for Code Exchange) during the OAuth2 authentication process.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-UserUrl
An optional User URL to obtain user information from the Access Token.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 7
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-UserUrlMethod
An optional HTTP method to use when calling the User URL. (Default: Post)
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 8
Default value: Post
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.