pimpler
08/02/2023, 7:39 AMconst {authentication} = await GoogleAuth.signIn();
console.log('authentication', JSON.stringify(authentication))
try {
const body = {
thirdPartyId: "google",
oAuthTokens: {
id_token: authentication.idToken,
access_token: authentication.accessToken,
refresh_token: authentication.refreshToken,
},
clientId: "XYZ.apps.googleusercontent.com"
};
const stringifyBody = JSON.stringify(body);
console.log('stringifyBody', stringifyBody)
let signInUpResponse = await fetch(
`${import.meta.env.VITE_BACKEND_URL}/auth/signinup`,
{
method: 'post',
body: stringifyBody,
headers: {
rid: "thirdpartyemailpassword"
}
});
const response = await signInUpResponse.json();
if (response.status !== "OK") {
console.log(JSON.stringify(response))
throw new Error("Google login failed");
}
} catch (e) {
console.log(`failed with ${e}`)
}
rp_st
08/02/2023, 7:40 AMpimpler
08/02/2023, 6:39 PMpimpler
08/02/2023, 6:39 PMSuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).
Powered by