KorbsOriginal post
Web Developer
In the Server-Side Rendering Astro template, I'm currently trying to get it to work where the user can update their account.
I've added an input field where they can update their name, but when submitting it, I get the following error:
Bash
02:53:01 [watch] src/pages/account.astro02:53:03 [ERROR] app.67de538f000787f352da@service.localhost (role: applications) missing scope (account) Stack trace: at Client.call (/home/korbs/demos-for-astro/server-side-rendering/node_modules/node-appwrite/lib/client.js:206:15) [...] See full stack trace in the browser, or rerun with --verbose.The following code was added to src/pages/account.astro:
JavaScript
---...if (Astro.request.method === "POST") { const data = await Astro.request.formData(); const name = data.get("name") as string; const { account } = createAdminClient(); await account.updateName(name); return Astro.redirect("/account?=username_updated");}...---
...<section> <p>Change name:</p> <form method="POST"> <input style="background: #1c1c21;border: 1px #2c2c30 solid;padding: 6px 12px;border-radius: 6px;" id="name" name="name"/> <button class="button is-secondary is-full-width" type="submit">Update Username</button> </form></section>...The API key I used as access to all scopes.
Summary
Developers are encountering a missing scope (account) error when trying to update a user's account name in the Astro template. The issue lies in the API key lacking necessary permissions. To solve this, ensure the API key has access to the 'account' scope.