From 314a3c1db9d950226217e0f46e5c4334dac32682 Mon Sep 17 00:00:00 2001 From: "H. Arnold Jones" Date: Sat, 9 Jul 2016 11:49:22 -0400 Subject: [PATCH] fix(authorization): header workaround for IE11 use cookie instead so auth succeeds --- templates/app/server/auth(auth)/auth.service.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/app/server/auth(auth)/auth.service.js b/templates/app/server/auth(auth)/auth.service.js index 5cab4df4c..43de0a3c5 100644 --- a/templates/app/server/auth(auth)/auth.service.js +++ b/templates/app/server/auth(auth)/auth.service.js @@ -24,6 +24,10 @@ export function isAuthenticated() { if (req.query && req.query.hasOwnProperty('access_token')) { req.headers.authorization = 'Bearer ' + req.query.access_token; } + // IE11 forgets to set Authorization header sometimes. Pull from cookie instead. + if (req.query && typeof req.headers.authorization === 'undefined') { + req.headers.authorization = 'Bearer ' + req.cookies.token; + } validateJwt(req, res, next); }) // Attach user to request