source/middleware/authentication.js
function get_jwt_token(ctx)
{
	// Parses "Authorization: Bearer ${token}"
	if (ctx.header.authorization)
	{
		const match = ctx.header.authorization.match(/^Bearer (.+)$/i)

		if (match)
		{
			return match[1]
		}
	}

	// (doesn't read cookies anymore to protect users from CSRF attacks)
	// // Tries the "authentication" cookie
	// if (ctx.cookies.get('authentication'))
	// {
	// 	return ctx.cookies.get('authentication')
	// }
}
function get_jwt_token(ctx)
{
	// Parses "Authorization: Bearer ${token}"
	if (ctx.header.authorization)
	{
		const match = ctx.header.authorization.match(/^Bearer (.+)$/i)

		if (match)
		{
			return match[1]
		}
	}

	// (doesn't read cookies anymore to protect users from CSRF attacks)
	// // Tries the "authentication" cookie
	// if (ctx.cookies.get('authentication'))
	// {
	// 	return ctx.cookies.get('authentication')
	// }
}
function get_jwt_token ( ctx ) { // Parses "Authorization: Bearer ${token}" if ( ctx . header . authorization ) { const match = ctx . header . authorization . match ( / ^Bearer (.+)$ / i ) if ( match ) { return match [ 1 ] } } // (doesn't read cookies anymore to protect users from CSRF attacks) // // Tries the "authentication" cookie // if (ctx.cookies.get('authentication')) // { // 	return ctx.cookies.get('authentication') // } }
Looks for JWT token inside HTTP Authorization header
Looks for JWT token inside HTTP Authorization header