const router = express.Router();
const client = new Client()
.setEndpoint(process.env.APPWRITE_ENDPOINT!)
.setProject(process.env.APPWRITE_PROJECT_ID!);
const account = new Account(client);
router.post("/", async (req: Request, res: Response) => {
try {
const session = await account.createAnonymousSession();
const jwt = await account.createJWT();
res.cookie("token", jwt.jwt, { httpOnly: true });
res.json({
message: "Anonymous login successful",
});
} catch (error) {
res.status(500).json({ error: (error as Error).message });
}
});
"error": "User (role: guests) missing scope (account)"
Any solutions? My end goal is to be able to convert anonymous users to full users and preserve everything while doing so
afaik, you need to set the session secret on client after a login.
session secret is only retrieved when using server sdk with key.
Recommended threads
- How can I disable client-side account re...
Hi everyone! I’m currently building a game backend using Appwrite, and I’d like to prevent users from creating new accounts directly through the client. My go...
- relationships bug or error idk
hey every one, am using am using appwrite on a project and ran into a problem where by created a relationship and two way to be specific and it is stuck on proc...
- Domain is owned by a different organizat...
Hi Appwrite team, I'm trying to add my custom domain **futlive9.com** to my project, but I'm getting the error: "Domain is owned by a different organization." ...