Description
👟 Reproduction steps
install appwrite and expo for react native development
👍 Expected behavior
const createEmailToken = useCallback(async (email: string): Promise<void> => {
setIsLoading(true);
try {
const emailtoken = await account.createEmailToken(ID.unique(), email, true);
console.log('Email token sent successfully', emailtoken);
} catch (error) {
console.error("Failed to send email token:", error);
throw error;
} finally {
setIsLoading(false);
}
}, []);
// New method to verify email token
const verifyEmailToken = useCallback(
async (userId: string, token: string): Promise<void> => {
setIsLoading(true);
try {
// Create session using the token
const session = await account.createSession(userId, token);
if (!session) {
throw new Error('Failed to create session');
}
// Get user data after successful session creation
const userData = await account.get();
// Update user state
setUser((prevUser) =>
JSON.stringify(userData) !== JSON.stringify(prevUser) ? userData : prevUser
);
// Save session
await saveSession(userData);
console.log("Email token verified successfully");
} catch (error) {
console.error("Failed to verify email token:", error);
throw error;
} finally {
setIsLoading(false);
}
},
[saveSession]
);
trying to use these 2 functions to do 2 step verification in a react native application, i understand i cant use api key here so the appwrite backend sends the template for me via the configured templates, but i dont know which variables show the secret or otp and there is no clears documentation about all the variables for each template, example i tried using the otp session template the way it is in the dashboard, but am getting this below, i dont know if its parsing that is bad or am not using the correct variables, which i have tried finding the docs for and i couldnt.
👎 Actual Behavior
while sending an email am getting this screen short rather than the otp token so that i can use it for verification
🎲 Appwrite version
Version 1.6.x
💻 Operating system
Linux
🧱 Your Environment
No response
👀 Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- I have read the Code of Conduct