Public/new-IDNOAuthclient.ps1
# # new_IDNOAuthclient.ps1 # function new-IDNOAuthClient { param ( [string]$orgName, $authHeader, [parameter(Mandatory=$true)][string]$businessName, [string]$homePageURL='http:\\localhost', [parameter(Mandatory=$true)][string]$name, [parameter(Mandatory=$true)][string]$Description, [int]$accessTokenValiditySeconds=750, [int]$refreshTokenValiditySeconds=86400, [string[]]$redirectUris=@('http:\\localhost:12345'), [validateset('PASSWORD','CLIENT_CREDENTIALS','AUTHORIZATION_CODE','REFRESH_TOKEN')] [string[]]$grantTypes=@('PASSWORD','CLIENT_CREDENTIALS','AUTHORIZATION_CODE','REFRESH_TOKEN'), ) $grantTypes=$grantTypes | sort | Get-Unique $request=[pscustomobject]@{ businessName=$businessName homePageURL=$homePageURL name=$name description=$Description accessTokenValiditySeconds=$accessTokenValiditySeconds refreshTokenValiditySeconds=$refreshTokenValiditySeconds redirectUris=$redirectUris grantTypes=$grantTypes accessType="OFFLINE" enabled=$true strongAuthSupported=$false } return Invoke-RestMethod -Method Post -UseBasicParsing -Headers $authHeader -Uri "https://$orgName.api.identitynow.com/beta/oauth-clients" -Body ($request | convertto-json) -ContentType 'application/json' } |