jscarle/OnePassword.NET

does your library work with the service accounts?

MannusEtten opened this issue · 7 comments

does your library work with the service accounts?

Possibly not the cleanest option but this works if you want to use a service account:
Environment.SetEnvironmentVariable("OP_SERVICE_ACCOUNT_TOKEN", token);
_onePassword = new OnePasswordManager(appIntegrated: true);

_onePassword.GetVaults()

If time permits it in the coming days/weeks I will create a PR to set the token variable as part of the StartProcess (en not the complete session as what is Environment.SetEnvironmentVariable doing). Certain commands are not allowed when using ServiceAccounts I will also see if I can check that before executing them.

thanks! will be highly appreciated because I seriously considering to incorporate your library into my software product. In that case I will maybe be able as well to help you.

For now the workaround to set it at process level will get you going.

added support for service accounts in #38

I have seen it, I will wait till your pull request is accepted so I can get it from NuGet. What I wonder about is the constructor with the service account token. In the documentation of the OP.exe it states you need to declare an env-variable. I see you set it during the execution of the exe. Could it be made optional so I can set it by myself in the Windows-configuration. In that case the token will not be included in my configuration-files.

I do use the process-code as well for running some .exe-files, I discovered the SimpleExec-nuget package to help with this. Really nice package.

Thanks @knippers for the addition. I also added the support for options in the constructor, as well as some interfaces to simplify Moq testing. It's also been published with support for .NET 8.0.

It's now been released on Nuget as v2.2.0.