From 04a6071fb651afd1d4d64113bba043ccf14e04e5 Mon Sep 17 00:00:00 2001 From: mk1020 Date: Fri, 5 Nov 2021 18:50:40 +0200 Subject: [PATCH] add email to response oAuth google --- app/components/auth/oAuth.scheme.ts | 1 + app/components/auth/oAuth.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/components/auth/oAuth.scheme.ts b/app/components/auth/oAuth.scheme.ts index 45ac83d..350609b 100644 --- a/app/components/auth/oAuth.scheme.ts +++ b/app/components/auth/oAuth.scheme.ts @@ -22,6 +22,7 @@ export const oAuthGoogleScheme: FastifySchema = { } }, userId: {type: 'number'}, + email: {type: 'string'}, } }, 500: { diff --git a/app/components/auth/oAuth.ts b/app/components/auth/oAuth.ts index ae42088..1a54c58 100644 --- a/app/components/auth/oAuth.ts +++ b/app/components/auth/oAuth.ts @@ -24,7 +24,7 @@ export const oAuth = async (server: FastifyInstance) => { return reply .header('Content-Type', 'application/json; charset=utf-8') .status(201) - .send(JSON.stringify({userId, token})); + .send(JSON.stringify({userId, token, email: payload.email})); } catch (e) { return reply.status(500).send(e); }