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:
Pierre Gayvallet 2023-11-14 22:19:38 +01:00 committed by GitHub
parent 7728c8440f
commit 6ebad69948
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 8 deletions

View file

@ -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.\\"}",
]
`);
});

View file

@ -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.\\"}",
]
`);
});

View file

@ -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.\\"}",
]
`);
});

View file

@ -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);
}
}