Hey
@rp_st
I'm trying to use supertoken with my capacitor mobile app. I'm already using supertokens with email + password + google auth in my web version.
I'm using this plugin:
https://github.com/CodetrixStudio/CapacitorGoogleAuth and I used the example in
https://github.com/supertokens/supertokens-react-native/blob/master/examples/with-thirdpartyemailpassword/google.js in order to make it work.
I managed to get response from google auth, and to send the response to my backend, but Im allways getting the following error: "Please provide the thirdPartyId in request body".
This is the request I send:
const {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}`)
}