You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
![Image](https://github.com/user-attachments/assets/93b5b255-7b95-4c04-98d0-c43ba1e92a2c)
### 👀 Have you spent some time to check if this issue has been raised before?
- [x] I checked and didn't find similar issue
### 🏢 Have you read the Code of Conduct?
- [x] I have read the [Code of Conduct](https://github.com/appwrite/.github/blob/main/CODE_OF_CONDUCT.md)
The text was updated successfully, but these errors were encountered:
💭 Description
The text was updated successfully, but these errors were encountered: