I am using ThirdPartyEmailPassword recipe. I am us...
# support-questions-legacy
s
I am using ThirdPartyEmailPassword recipe. I am using google to signin. I want to add profile to response which I will get from service. I got stuck which function should i ovveride to change the response?
r
Hey!
Can you please elaborate on what you want to do? I’m not sure I completely understand
s
I am trying to return something on response with addition to the default response while signin with google.
r
Which recipe?
s
ThirdPartyEmailPassword
And you want to override the
thirdPartySignInUpPOST
function
s
do i need to override emailPasswordEmailExistsGET function?
r
Not for this. Cause google sign in doesn’t require emailpassword login methods
s
i have override this thirdPartySignInUpPOST function but it doesn't return profile no matter what i do
r
Can you show me some code please?
Can you please format this?
s
okay sure
ThirdPartyEmailPassword.init({ override: { apis: (originalImplementation) => { return { ...originalImplementation, thirdPartySignInUpPOST: async function (input) { if (originalImplementation.thirdPartySignInUpPOST === undefined) { throw new Error("Should never come here"); } const originalResponse = await originalImplementation.thirdPartySignInUpPOST(input); if (originalResponse.status === "OK") { let profile = getProfileById(originalResponse.user.id) return { ...originalResponse, profile, }; } else { return { ...originalResponse }; } }, }; }, }, providers: [ Google({ clientId: config.supertokens.providers.google.client_id as string, clientSecret: config.supertokens.providers.google .client_secret as string, }), ], }),
r
Right. So just returning does not work
If you see the link I had sent, that actually writes to the response object
s
input.options.res.sendJSONResponse({ profile: profile })
so i need to add this?
but it doesn't work
r
So you need to add the profile info in and and that stuff that the api sends anyway.
Along with set the status code to 200 (as shown in the link above)