I am trying to test my auth function for firestore in the emulator suite. Is it normal to get this error when trying to authenticate a user via google?
This doc from Firebase seems to suggest that google auth should work in the emulator suite. https://firebase.google.com/docs/emulator-suite/connect_auth
This is an excerpt from the document:
Note that the emulator only supports signInWithCredential authentication for credentials retrieved from Google Sign-In, Apple, and other providers that use ID tokens implemented as JSON Web Tokens (JWTs). Access tokens (e.g. those provided by Facebook or Twitter, which are not JWTs) are not supported. The next section discusses an alternative in these cases.
However I am getting this error: Received a signed JWT. Auth Emulator does not validate JWTs and IS NOT SECURE
Appreciate any help on this! This is the function which is authenticating the user:
exports.createStripeCustomer = functions.auth.user().onCreate(async (user) => {
const customer = await stripe.customers.create({ email: user.email });
const intent = await stripe.setupIntents.create({
customer: customer.id,
});
await admin.firestore().collection('stripe_customers').doc(user.uid).set({
customer_id: customer.id,
setup_secret: intent.client_secret,
});
return;
});
A customer has been created in the stripe console when running this code, but it has not created a customer in the firestore
onCreate()
, which isn't relevant here, please update your code and include how you sign users in. In this example, we could guess that you somehow calledsignInWithCustomToken()
where you really should usesignInWithCredential()
.