pusher: add missing Content-Type header for json responses

This commit is contained in:
Ludwig Behm
2022-02-12 22:19:48 +01:00
parent 55c2c2e555
commit 9073024b1d
2 changed files with 8 additions and 0 deletions
@@ -79,6 +79,7 @@ export class AuthenticateController extends BaseController {
if (!code && !nonce) {
res.writeStatus("200");
this.addCorsHeaders(res);
res.writeHeader('Content-Type', 'application/json');
return res.end(JSON.stringify({ ...resUserData, authToken: token }));
}
console.error("Token cannot to be check on OpenId provider");
@@ -91,6 +92,7 @@ export class AuthenticateController extends BaseController {
const resCheckTokenAuth = await openIDClient.checkTokenAuth(authTokenData.accessToken);
res.writeStatus("200");
this.addCorsHeaders(res);
res.writeHeader('Content-Type', 'application/json');
return res.end(JSON.stringify({ ...resCheckTokenAuth, ...resUserData, authToken: token }));
} catch (err) {
console.info("User was not connected", err);
@@ -121,6 +123,7 @@ export class AuthenticateController extends BaseController {
res.writeStatus("200");
this.addCorsHeaders(res);
res.writeHeader('Content-Type', 'application/json');
return res.end(JSON.stringify({ ...data, authToken }));
} catch (e) {
console.error("openIDCallback => ERROR", e);
@@ -183,6 +186,7 @@ export class AuthenticateController extends BaseController {
const authToken = jwtTokenManager.createAuthToken(email || userUuid);
res.writeStatus("200 OK");
this.addCorsHeaders(res);
res.writeHeader('Content-Type', 'application/json');
res.end(
JSON.stringify({
authToken,
@@ -222,6 +226,7 @@ export class AuthenticateController extends BaseController {
const authToken = jwtTokenManager.createAuthToken(userUuid);
res.writeStatus("200 OK");
this.addCorsHeaders(res);
res.writeHeader('Content-Type', 'application/json');
res.end(
JSON.stringify({
authToken,