carlosbm
carlosbm
CCConvex Community
Created by carlosbm on 3/11/2025 in #support-community
Send params from signIn to sendVerificationRequest using ResendOTP
Hello team! I'm trying to pass the language of the user when he signs in to the app so that I can send the verification OTP email in that language. I'm not finding a way to do it. What I have in my react-native: await signIn("resend-otp", { email: parsedEmail, options: { language: "en", }, test: "test", // I was testing with this. }) And this is the configured Resend provider: export const ResendOTP = Email({ id: "resend-otp", apiKey: process.env.AUTH_RESEND_KEY, maxAge: 60 * 15, // 15 minutes async generateVerificationToken() { return generateRandomString(4, alphabet("0-9")) }, async sendVerificationRequest(params) { const { identifier: email, provider, token } = params // Extract language from params.options if it exists, defaulting to "en" const options = params as unknown as { options?: CustomOptions } const language = options.options?.language || "en" console.log("Params:", params) console.log("Language:", language) // Create i18n instance for fallback text const t = createEmailI18n(language) const resend = new ResendAPI(provider.apiKey) const { error } = await resend.emails.send({ from: "Shifty <onboarding@test.com>", to: [email], subject: t("email.verification.subject"), text: t("email.verification.code") + ": " + token, react: ShiftyVerificationEmail({ verificationCode: token, language: language as Language, }), }) if (error) { throw new Error(JSON.stringify(error)) } }, }) And here neither in Params logs or Language I can see the desired params. Thanks in advance! Let me know what I can do in this case.
11 replies
CCConvex Community
Created by carlosbm on 1/21/2024 in #support-community
Upload Video from a RN Expo app to the Convex Storage
Hello! I'm having trouble saving a video from a RN Expo app to the Convex Storage. In the examples, there are only references to upload images. I'm trying to build a formData and doing several things, but I cannot get it working. I managed to upload the video to the Storage, and I see it uploaded with the proper size, but cannot change the name, nor I can play the video after downloading it because it is saved in a different extension. This is the code I have right now, if someone could help me would be great! Thanks!
const postUrl = await generateUploadUrl();

const form = new FormData();
form.append("video", {
uri,
type: "video/*",
name: "video.mp4",
});

// Step 2: POST the file to the URL
const result = await fetch(postUrl, {
method: "POST",
headers: { "Content-Type": "multipart/form-data" },
body: form,
});

const { storageId } = await result.json();
// Step 3: Save the newly allocated storage id to the database
await saveVideoStorageId({ videoStorageId: storageId });
const postUrl = await generateUploadUrl();

const form = new FormData();
form.append("video", {
uri,
type: "video/*",
name: "video.mp4",
});

// Step 2: POST the file to the URL
const result = await fetch(postUrl, {
method: "POST",
headers: { "Content-Type": "multipart/form-data" },
body: form,
});

const { storageId } = await result.json();
// Step 3: Save the newly allocated storage id to the database
await saveVideoStorageId({ videoStorageId: storageId });
7 replies