I am automating the creation of CONNECTED projects and need to use this Get-OIDCToken in order to make a final change to the project, when using Set-PWWorkAreaConnectionUserSync. I am stuck on how to get this to function as an unattended step in the script. Can this token be stored in any way that would allow for it to be read into the script similar to how other encrypted passwords can be pulled from text files etc?
dave
We have the same requirement to run the Get-OIDCToken in an 'unattended' mode, when using the Add-ImodelNamedVersion module.Kind regards Gavin
You don't have to persist the token. PowerShell implicitly saves it for you. Please see the following thread:
https://communities.bentley.com/products/projectwise/content_management/f/projectwise-powershell-extensions-forum/224574/get_oidctoken-expiration
Mark Weisman | Bentley Systems
Hi Mark, unfortunatly that doesn't work :( the refresh token always wants me to click the 'apply' button, even after having run the "Get-OIDCToken -NewToken" module earlier in the day.
$oidcToken = Get-OIDCToken -UseCacheIfAvailable If ($OIDCtoken.TTL() -lt 100){ If ( $OIDCtoken.Refresh() -eq $false){ Write-Error "script cannot continue because OIDCToken expired" return } }
and I need the $oidcToken token for the Add-ImodelNamedVersion module..
$p = Add-ImodelNamedVersion -ImodelId $iModelID -NamedVersion $VersionName -OIDCToken $oidcToken
any other ideas?Kind regards Gavin Chapman