Web Developer
I created a function to handle custom tokens. If I do the execution from the uppwrite platform everything works fine. if I make a request from postman or from the application client nothing gets anywhere. Or it generates errors.
Am I doing the function request correctly? Nothing comes through when I call this function.
export async function authenticateWithTelegram(webAppUser, username) {
try {
const response = await fetch('http://667eca820456a6e6a0fe.appwrite.global/', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Appwrite-Key': apiJWT
},
body: JSON.stringify({
telegramUserId: webAppUser.toString(),
telegramUsername: username,
}),
});
const data = await response.json();
console.log('Server response:', data);
const session = await account.createSession(userId, secret);
console.log('Session created:', session);
return session;
} catch (error) {
console.error('Authentication error:', error);
throw error;
}
}