This commit is contained in:
Zack Meier
2026-04-15 15:45:50 -05:00
commit 1d304511b8
613 changed files with 140998 additions and 0 deletions
@@ -0,0 +1,46 @@
Function Get-SectigoApiToken {
#[CmdletBinding()]
. $PSScriptRoot\..\Private\Set-Onload.ps1
[string]$tokenEndpoint = $AuthBaseAPIUrl + "/auth/realms/apiclients/protocol/openid-connect/token"
$clientId=$env:Sectigoclientid
$clientSecret=$env:SectigoclientSecret
if (-Not $clientid) {
$clientid=Read-Host "Please enter your clientid"
}
if (-Not $clientSecret) {
$clientSecret=Read-Host "Please enter your clientSecret"
}
Write-Verbose -Verbose "tokenEndpoint: $tokenEndpoint "
# Prepare the body for the token request
$body = @{
grant_type = "client_credentials"
client_id = $clientId
client_secret = $clientSecret
}
. $PSScriptRoot\..\Private\Set-Onload.ps1
# Request the access token
try {
$tokenResponse = Invoke-RestMethod -Uri $tokenEndpoint -Method Post -Body $body -ContentType "application/x-www-form-urlencoded"
$accessToken = $tokenResponse.access_token
$env:SectigoToken=$accessToken
if ($accesstoken) { Write-Verbose -Verbose 'Token Set $ENV:SectigoToken'}
}
catch {
Write-Error "Failed to obtain access token: $($_.Exception.Message)"
#exit 1
}
}