mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Switched default API version for JWT
refs https://github.com/TryGhost/Ghost/issues/12716 - This change is made to avoid using now deprecated 'v2' API anywhere in the codebase. - Switching to 'v4' should not cause sideeffects as this parameter is always present within the URL when Admin API is used
This commit is contained in:
parent
b3542e9176
commit
9a6bfd0e71
@ -119,7 +119,7 @@ const authenticateWithToken = (req, res, next, {token, JWT_OPTIONS}) => {
|
|||||||
const secret = Buffer.from(apiKey.get('secret'), 'hex');
|
const secret = Buffer.from(apiKey.get('secret'), 'hex');
|
||||||
|
|
||||||
const {pathname} = url.parse(req.originalUrl);
|
const {pathname} = url.parse(req.originalUrl);
|
||||||
const [hasMatch, version = 'v2', api = 'admin'] = pathname.match(/ghost\/api\/([^/]+)\/([^/]+)\/(.+)*/); // eslint-disable-line no-unused-vars
|
const [hasMatch, version = 'v4', api = 'admin'] = pathname.match(/ghost\/api\/([^/]+)\/([^/]+)\/(.+)*/); // eslint-disable-line no-unused-vars
|
||||||
|
|
||||||
// ensure the token was meant for this api version
|
// ensure the token was meant for this api version
|
||||||
const options = Object.assign({
|
const options = Object.assign({
|
||||||
|
Loading…
Reference in New Issue
Block a user