Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Conversation

@erikgraa
Copy link
Contributor

Summary

After an access token expires, the first cmdlet to run afterwards will fail because the old access token is still being used.

By adding createHeader to checkVcfToken if a new access token has been requested and received, the cmdlet that first invokes checkVcfToken post-expiry will also work.

Example - pre-fix

Pretend that it's more than an hour since Request-VCFToken was run and that the access token is now expired.

Get-VCFCluster

Error Message:
{
  "errorCode": "Unauthorized", 
  "message": "Authorization Header is missing or not in correct format" 
}

# Re-running this or any other cmdlet will work
# At this point the cmdlet works because createHeader is run at the start of the cmdlet with the fresh access token from $global:accessToken

Get-VCFCluster

Type

  • Bugfix
  • Enhancement or Feature
  • Code Style or Formatting
  • Documentation
  • Refactoring
  • Chore
  • Other
    Please describe:

Breaking Changes?

  • Yes, there are breaking changes.
  • No, there are no breaking changes.

Test and Documentation

N/A

Issue References

N/A

Additional Information

N/A

@erikgraa erikgraa force-pushed the fix/checkVcfToken-first-pass branch from a0b811d to 47263dd Compare May 10, 2025 00:59
@github-actions github-actions bot added the needs-review Needs Review label May 10, 2025
…en function

Signed-off-by: Erik Grina Raassum <erik.raassum@gmail.com>
@erikgraa erikgraa force-pushed the fix/checkVcfToken-first-pass branch from 47263dd to 63bb2b8 Compare May 10, 2025 01:22
@tenthirtyam tenthirtyam added enhancement Enhancement and removed needs-review Needs Review labels May 10, 2025
@tenthirtyam tenthirtyam changed the title fix: add createHeader to checkVcfToken so invoking cmdlet can make use of newly requested access token after current has expired feat: refresh access token May 10, 2025
@github-actions github-actions bot added the needs-review Needs Review label May 10, 2025
@tenthirtyam tenthirtyam merged commit b1f50cd into vmware:develop May 10, 2025
3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement Enhancement needs-review Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants