rajanadar / VaultSharp

A comprehensive cross-platform .NET Library for HashiCorp's Vault, a secret management tool
http://rajanadar.github.io/VaultSharp
Apache License 2.0
493 stars 134 forks source link

Using AppRole login, getting returned token, etc. #274

Closed MB34 closed 2 years ago

MB34 commented 2 years ago

I'm attempting to use the AppRole method of logging in and understand that a Token is supposed to be returned, Per: https://bytemeta.vip/repo/rajanadar/VaultSharp/issues/212 The line to get the ReturnedLoginAuthInfo.ClientToken. returns null. The role_id and secrets_id are correct. Can someone help out here? Am I supposed to generate a new secrets_id before each call?

        `AppRoleAuthMethodInfo appRoleAuth = new AppRoleAuthMethodInfo(
            roleId: role_id,
            secretId: secrets_id
        );

        IVaultClient client = new VaultClient(
            new VaultClientSettings(settings.Address, appRoleAuth)
        );
        client.V1.Auth.PerformImmediateLogin();

        string s = appRoleAuth.ReturnedLoginAuthInfo.ClientToken.ToString();

        IAuthMethodInfo authMethod = new TokenAuthMethodInfo(s);
        var vaultClientSettings = new VaultClientSettings(settings.Address, authMethod);

        IVaultClient vaultClient = new VaultClient(vaultClientSettings);`
MB34 commented 2 years ago

Deleting

MB34 commented 2 years ago

Deleting this