I was using Appwrite trying to create a login component in Framer but I am getting an error when I use the createEmailPasswordSession method. The same code works on my Next JS application on localhost but when I try calling this method from the framer component it gives me this error:
Here's my code: import { useState } from "react" import { Client, Account } from "appwrite"
/**
- These annotations control how your component sizes
- Learn more: https://www.framer.com/developers/components/auto-sizing
- @framerSupportedLayoutWidth auto
- @framerSupportedLayoutHeight auto */
export default function Auth(props) { const [email, setEmail] = useState("krutik@framer.com") const [password, setPassword] = useState("<PASSWORD>")
const client = new Client().setProject("66be39a70024858da9ff")
const account = new Account(client)
async function handleSubmit() {
if (email === "" || password === "") {
return
}
try {
const result = await account.createEmailPasswordSession(
email,
password
)
console.log(`success: `, result)
} catch (e) {
console.log(`fail: `, e)
}
}
return (
<div style={{ display: "flex", flexDirection: "column", gap: 12 }}>
<input
style={inputStyle}
type="email"
placeholder="krutik@framer.com"
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
<input
style={inputStyle}
type="password"
placeholder="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
/>
<button onClick={handleSubmit} style={buttonStyle}>
Login
</button>
</div>
)
}
Recommended threads
- Unable to change auth email "preview" me...
Unfortunately I have not been able to change the initial sentence in the auth emails with custom smtp added in Appwrite. They are not included in the editable t...
- Want to integrate my university server t...
Hello <@870607367597850624> i want to use the appwrite backend services for my university website,I want to know that is it possilbe that i could use the backen...
- Customize phone otp template
Hii..is there any way to customize phone otp template in 1.8 self hosted version? Also may i know where is the phone otp message template so that i can apply fo...