In your authentication.ps1 file, you can use the $Credential that is provided.
param($Credential)
Invoke-RestMethod http://localhost:5000/api/v1/variable -METHOD Post -Body (@{
name = $Credential.UserName
type = "PSCredential"
userName = $Credential.UserName
password = $Credential.GetNetworkCredential().Password
vault = "BuiltInLocalVault"
} | ConvertTo-Json) -Headers @{ Authorization = "Bearer $AppToken" } -ContentType 'application/json'