From: Justin Wind Date: Tue, 27 Dec 2022 21:57:58 +0000 (-0800) Subject: fix introspection request headers X-Git-Tag: v1.2.1~1 X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;h=91ccbf258b9f21a3c82f714c5fbb965644279bf4;p=squeep-indieauth-helper fix introspection request headers --- diff --git a/lib/communication.js b/lib/communication.js index d52d784..a9eb661 100644 --- a/lib/communication.js +++ b/lib/communication.js @@ -792,15 +792,15 @@ class Communication { /** * Verify a token with an IdP endpoint, using the Authentication header supplied. * @param {URL} introspectionUrlObj - * @param {String} authenticationHeader + * @param {String} authorizationHeader * @param {String} token */ - async introspectToken(introspectionUrlObj, authenticationHeader, token) { + async introspectToken(introspectionUrlObj, authorizationHeader, token) { const _scope = _fileScope('introspectToken'); const formData = common.formData({ token }); const postIntrospectConfig = Communication._axiosConfig('POST', introspectionUrlObj, formData, {}, { - [Enum.Header.Authentication]: authenticationHeader, + [Enum.Header.Authorization]: authorizationHeader, [Enum.Header.ContentType]: Enum.ContentType.ApplicationForm, [Enum.Header.Accept]: `${Enum.ContentType.ApplicationJson}, ${Enum.ContentType.Any};q=0.1`, }); diff --git a/lib/enum.js b/lib/enum.js index dcec131..984e19b 100644 --- a/lib/enum.js +++ b/lib/enum.js @@ -12,8 +12,10 @@ module.exports = { Header: { Accept: 'Accept', + Authorization: 'Authorization', ContentType: 'Content-Type', Link: 'Link', UserAgent: 'User-Agent', + WWWAuthenticate: 'WWW-Authenticate', }, }; \ No newline at end of file