AuthenticationΒΆ
For security reasons, PSCouchDB does not use CouchDB token cookies. But authentication can be stored inside the current powershell session.
By default, credential storage is allowed so that the Authorization
parameter can only be specified once.
To modify the saved credential preference, set this:
$CouchDBSaveCredentialPreference = $false # default is $true
Set a cookie:
$password = "password" | ConvertTo-SecureString -AsPlainText -Force
Set-CouchDBSession -UserId admin -Password $password
Set-CouchDBSession -UserId admin # prompt password
Get a session:
Get-CouchDBSession # PSCredential
Get-CouchDBSession -Clear # string format user:password
Now let verify a protected read database without Authorization
param:
Get-CouchDBDatabase -Database test
And remove a session:
Remove-CouchDBSession