Skip to content

Commit

Permalink
fix: update checkVcfToken function (#254)
Browse files Browse the repository at this point in the history
Updated the module's internal `checkVCFToken` function to ensure and expired token can be refresh when using PowerShell 7.

Signed-off-by: Ryan Johnson <[email protected]>
  • Loading branch information
tenthirtyam authored Dec 15, 2023
1 parent 6b9237f commit 58825f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release History

## v2.4.1

> Released: 2023-12-15
- Updated the module's internal `checkVCFToken` function to ensure and expired token can be refresh when using PowerShell 7.

## v2.4.0

> Released: 2023-10-02
Expand Down
6 changes: 3 additions & 3 deletions PowerVCF.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@

# Module manifest for module 'PowerVCF'
# Generated by: Broadcom
# Generated on: 2023-11-28
# Generated on: 2023-12-15

@{

# Script module or binary module file associated with this manifest.
RootModule = 'PowerVCF.psm1'

# Version number of this module.
ModuleVersion = '2.5.0.1000'
ModuleVersion = '2.4.1.1000'

# Supported PSEditions
# CompatiblePSEditions = @()
Expand All @@ -20,7 +20,7 @@ ModuleVersion = '2.5.0.1000'
GUID = '0558cc7e-71a6-4b08-b9be-341d22653128'

# Author of this module
Author = 'VMware'
Author = 'Broadcom'

# Company or vendor of this module
CompanyName = 'Broadcom'
Expand Down
1 change: 1 addition & 0 deletions PowerVCF.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -4401,6 +4401,7 @@ Function checkVCFToken {
if ($expiryDetails.timeToExpiry.Hours -eq 0 -and $expiryDetails.timeToExpiry.Minutes -lt 2) {
Write-Output "API Access Token Expired. Requesting a new access token with current refresh token."
$headers = @{"Accept" = "application/json" }
$headers.Add("Content-Type", "application/json")
$uri = "https://$sddcManager/v1/tokens/access-token/refresh"
$response = Invoke-RestMethod -Method PATCH -Uri $uri -Headers $headers -Body $refreshToken
$Global:accessToken = $response
Expand Down

0 comments on commit 58825f2

Please sign in to comment.