TypeScript
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
TL;DR
Developers want to create a JWT for an anonymous account but encounter a 'User (role: guests) missing scope (account)' error. The issue may be related to setting the session secret on the client after a login. Ensure the session secret is retrieved using the server SDK with the key. To fix this, you need to modify the code to include setting the session secret properly.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
- No server error on selfhosted appwrite
Please help me, my clients is ask what happen on their data? How can i make it up again?
- Upgrading selfhost version?
It is okay to upgrade version to higher one, of my current version is 1.7.4 to 1.8.1. Is that safe to do cause my clients already have data on that? Also is a...
- Streamlit UI and local DB
I want to use Appwrite for automation, like run watchdog service every morning 3 am. Anyone got suggestions, already explored github and documentation no luck. ...