5
0
Fork 0
mirror of https://github.com/hashicorp/vault-action.git synced 2025-11-14 18:13:45 +00:00
This commit is contained in:
Vincent Post 2021-11-11 18:27:30 +01:00
parent 10ec29c5fb
commit da71d5cb54
No known key found for this signature in database
GPG key ID: 0BE11DFD76C1BFCE

6
dist/index.js vendored
View file

@ -1328,6 +1328,8 @@ async function getClientToken(client, method, path, payload) {
core.debug(`Retrieving Vault Token from v1/auth/${path}/login endpoint`);
try {
/** @type {import('got').Response<VaultLoginResponse>} */
const response = await client.post(`v1/auth/${path}/login`, options);
if (response && response.body && response.body.auth && response.body.auth.client_token) {
@ -1342,6 +1344,10 @@ async function getClientToken(client, method, path, payload) {
} else {
throw Error(`Unable to retrieve token from ${method}'s login endpoint.`);
}
} catch (error) {
core.debug(error.response.body);
throw Error(`Unable to retrieve token from ${method}'s login endpoint.`);
}
}
/***