Add-PWConnectedProjectUsersOIDC used to add uses, can you apply a role at the same time?


Adding users to a Connected project up to this point I have been using the following code successfully for the past few weeks,

$bentleyToken = Get-PWConnectionClientToken

Add-PWUsersToConnectedProject -ConnectedProjectId $connProjID -Token $bentleyToken -Emails $UserEmails -Roles $roles

But increasingly I'm having issues with the Token returning 'Can't read token warning, which I can't seem to work out why its not working as I have latest PW admin and DM installed.

So I decided to go with this, 

$OidcToken3 = Get-OIDCToken -Authority -ClientID powershelltokengen -Verbose

Add-PWConnectedProjectUsersOIDC -OIDCToken $OidcToken3 -ConnectedProjectIds $projectArray -Emails $userArray

And it works, I can add an array of users to an array or connected projects, but there is no option to add the users to a role.

I have tried this, but I have the same problem as above where the token is not read.

Add-PWConnectedProjectUsersToRoles -ConnectedProjectId $Connectedproject -Roles "PS0 Viewer" -Token $bentleyToken

Is there another option to add Users to a Role in a connected project?

Is there a way to debug Get-PWConnectionClientToken using Bentley IMS 2FA?

Any help would be appreciated.