Handling of v1/auth/github/login redirect.
I don't really understand how it helps, I was able to get GithubAuth working via just a POST request but I am not sure I understand the example.
I think I understand what the examples does, step by step. It seems to try to auth first but for me it stops there because I don't yet have the token needed for auth so it goes directly to the error handling.
I am guessing it's because your example first enables GitHub auth (and therefore needs a token to do so). If I am correct, I am happy to submit a PR with more comments in the GitHub example.
When I do use vault.githubLogin by itself, it doesn't work because it doesn't follow a 307 that my vault throws at it. I am not sure it's something specific with my vault setup though.
Thank you in advance,
Erik
@edasque - I ran across a similar issue. The way I solved the 3xx response was to pass the request options as a field. For example:
vault.githubLogin({
githubToken,
requestOptions: {
followAllRedirects: true
}
});
@kr1sp1n we should consider adding the followAllRedirects: true request option by default, if it makes sense. I didn't do any research in this specific issue, but from my (somewhat limited) knowledge of the vault API, I think it wouldn't hurt to add this.
i have same issue
i think that is not just redirect
cuz i think node-vault is basically caller API of Vault and almost API need value of X-Vault-Token in header but this value set only time call vault.auths()
i think it is easy way that fix in handleVaultResponse function
check login url and if this request is login, set client.token
i will write example under
//that is regular expression to check url of login
if (/\/auth\/[^\/]+\/login/.test(response.request.uri.path)) {
client.token = response.body.auth.client_token;
}
but i dont sure that is right way :confused:
I was struggling with this problem with relating to approleLogin().
I was catching a 'Status 307' error and I'm really glad I found this page.
I completely agree that this should be set by default.
Noted for v1.0
@edasque @liambowers I think PR #93 may solve your problems. It is included since v0.9.3. Please check it out and give feedback. Thanks 🙏
Stale issue, closing