Issue accessing variables.

avatar

I created an unauthenticated API Endpoint "/getData" which uses variables and the $Secret scope to connect to other APIs and return aggregated data.

Issue1: the endpoint could not read all secrets and threw a security exception despite none of them had any role restrictions. Recreating the secrets worked, so some update must have corrupted the permission requirements of the secrets. Not sure if this is worth looking into.

Issue2: the endpoint needs to run an internal script viaInvoke-PSUScript -Integrated -Script 'AuthorizeToAPI.ps1' -Wait that handles the authentication to that external API. That script is able to be run unauthenticated, but needs update variables/secrets. This is what I used:

    $AccessTokenVar = Get-PSUVariable -Name "AccessToken"
    $AccessTokenLifetimeVar = Get-PSUVariable -Name "AccessTokenLifetime"

    $TokenResponse = Invoke-RestMethod "<externalAPIauthentication>" -Method 'POST' -Headers $Headers -Body $Body
    
    Set-PSUVariable -Variable $AccessTokenVar -Value $TokenResponse.Token
    Set-PSUVariable -Variable $AccessTokenLifetimeVar -Value $TokenResponse.LifeTime

which worked fine until the last update and suddenly returns an error:
Permission denied. The role specified does not have access to this resource.

Since Issue1 clearly pointed to some update corrupting role requirements to variables, I m at a loss on what is intended behavior and what is not. Are integrated scripts not able to use Get/Set-PSUVariable or did more permissions get corrupted?

Help would be much appreciated :)

All Comments (0)

Closed