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
- Password check in function
Hi, is there any way now for checking if the users password is correct in a function? I am creating a delete user function and before deleting I would like to c...
- Deployment fails after 15+ minutes: "Wai...
Hi, I'm Jayden. My email is jaydthom@haverford.org, and i'm having persistent deployment failures with my Next.js project. What happens: Push to GitHub trigg...
- Host Static HTML Site
I'm trying to deploy a static HTML website on my Appwrite self-hosted instance. I can't get it to work. I don't really understand the configuration. I have the ...