mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
action oauth : quieter logs (#171210)
## Summary Remove unnecessary details from warning log when fetching an oauth token throws an error.
This commit is contained in:
parent
7728c8440f
commit
6ebad69948
4 changed files with 4 additions and 8 deletions
|
@ -123,7 +123,7 @@ describe('requestOAuthClientCredentialsToken', () => {
|
|||
|
||||
expect(mockLogger.warn.mock.calls[0]).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"error thrown getting the access token from https://test for params: {\\"scope\\":\\"test\\",\\"client_id\\":\\"123456\\",\\"client_secret\\":\\"secrert123\\"}: {\\"error\\":\\"invalid_scope\\",\\"error_description\\":\\"AADSTS70011: The provided value for the input parameter 'scope' is not valid.\\"}",
|
||||
"error thrown getting the access token from https://test: {\\"error\\":\\"invalid_scope\\",\\"error_description\\":\\"AADSTS70011: The provided value for the input parameter 'scope' is not valid.\\"}",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
|
|
@ -125,7 +125,7 @@ describe('requestOAuthJWTToken', () => {
|
|||
|
||||
expect(mockLogger.warn.mock.calls[0]).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"error thrown getting the access token from https://test for params: {\\"assertion\\":\\"someJWTvalueishere\\",\\"scope\\":\\"test\\",\\"client_id\\":\\"client-id-1\\",\\"client_secret\\":\\"some-client-secret\\"}: {\\"error\\":\\"invalid_scope\\",\\"error_description\\":\\"AADSTS70011: The provided value for the input parameter 'scope' is not valid.\\"}",
|
||||
"error thrown getting the access token from https://test: {\\"error\\":\\"invalid_scope\\",\\"error_description\\":\\"AADSTS70011: The provided value for the input parameter 'scope' is not valid.\\"}",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
|
|
@ -132,7 +132,7 @@ describe('requestOAuthToken', () => {
|
|||
|
||||
expect(mockLogger.warn.mock.calls[0]).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"error thrown getting the access token from https://test for params: {\\"client_id\\":\\"123456\\",\\"client_secret\\":\\"secrert123\\",\\"some_additional_param\\":\\"test\\"}: {\\"error\\":\\"invalid_scope\\",\\"error_description\\":\\"AADSTS70011: The provided value for the input parameter 'scope' is not valid.\\"}",
|
||||
"error thrown getting the access token from https://test: {\\"error\\":\\"invalid_scope\\",\\"error_description\\":\\"AADSTS70011: The provided value for the input parameter 'scope' is not valid.\\"}",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
|
|
@ -52,11 +52,7 @@ export async function requestOAuthToken<T>(
|
|||
};
|
||||
} else {
|
||||
const errString = stringify(res.data);
|
||||
logger.warn(
|
||||
`error thrown getting the access token from ${tokenUrl} for params: ${JSON.stringify(
|
||||
bodyRequest
|
||||
)}: ${errString}`
|
||||
);
|
||||
logger.warn(`error thrown getting the access token from ${tokenUrl}: ${errString}`);
|
||||
throw new Error(errString);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue