node-vault icon indicating copy to clipboard operation
node-vault copied to clipboard

TOTP POST does not respect "followAllRedirects"?

Open whitebyte opened this issue 6 years ago • 2 comments

Consider this code:

const result = await this.vault.write(
    '/totp/keys/[email protected]',
    {
        url: 'otpauth://totp/SecSys:[email protected]?issuer=SecSys&secret=somesecret',
        requestOptions: {
            followAllRedirects: true
        }
    }
);

It works as expected when performing the request from, say, Postman, but always return "Status 301" when I call it from node-vault.

I'm pretty sure that Vault initialized and running. All GET request work as usual. Maybe it's somewhat related to https://github.com/kr1sp1n/node-vault/issues/23

node-vault 0.9.5

whitebyte avatar Feb 03 '19 10:02 whitebyte

As the comment in #23 said, you can pass that to the request options object, and that worked for me. That said, following redirects seems like a sensible default since none of these operations will work without it. It would be a potentially breaking change, so at least showing that in the docs could be helpful.

jtschulz avatar Apr 22 '19 18:04 jtschulz

Oh, and if @whitebyte 's code doesn't work, I did something slightly different:

const result = await this.vault.write(
    '/totp/keys/[email protected]',
    { url: 'otpauth://totp/SecSys:[email protected]?issuer=SecSys&secret=somesecret' },
    { followAllRedirects: true },
);

jtschulz avatar Apr 22 '19 18:04 jtschulz

No activity since 2k19; Closing for now :) feel free to reopen if needed

aviadhahami avatar Nov 10 '22 16:11 aviadhahami