User (role: guests) missing scope (account) after login; Self hosted; Auth
- 0
- Self Hosted
- Auth
- Web
![](https://cdn.discordapp.com/embed/avatars/1.png)
Hello! Probably it is something stupid but I can't figure it out. Read a ton of posts already and still need help. Self hosted Appwrite. Simplest login in web app. I am getting "User (role: guests) missing scope (account) after login" when I try to verify the login. Session for the user is being created correctly. Here is my route: ``` router.post("/auth/login", async (req, res) => { // Get the email and password from the request body let email = req.body.email; let password = req.body.password;
try { const client = new Client() .setEndpoint(process.env.AWENDPOINT) .setProject(process.env.AWPROJECTID);
let account = new Account(client);
const session = await account.createEmailPasswordSession(email, password);
console.log(session);
const awuser = await account.get(); // Here I am getting "User (role: guests) missing scope (account) after login"
console.log(awuser);
res.status(200).json({ success: true });
} catch (error) { console.error("Login error:", error.message, error.stack); } ... rest of my code.```
console.log(session) is giving me the following:
{
'$id': '66490a9639f94e3ba07e',
'$createdAt': '2024-05-18T20:07:50.243+00:00',
'$updatedAt': '2024-05-18T20:07:50.243+00:00',
userId: '6648fa0200031ffaa264',
expire: '2024-06-17T20:07:50.237+00:00',
provider: 'email',
providerUid: 'my@email.com',
providerAccessToken: '',
providerAccessTokenExpiry: '',
providerRefreshToken: '',
ip: '172.18.0.1',
osCode: '',
osName: '',
osVersion: '',
clientType: 'library',
clientCode: '',
clientName: 'Node Fetch',
clientVersion: '1.0',
clientEngine: '',
clientEngineVersion: '',
deviceName: '',
deviceBrand: '',
deviceModel: '',
countryCode: '--',
countryName: 'Unknown',
current: true,
factors: [ 'password' ],
secret: '',
mfaUpdatedAt: ''
}```
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
It looks like you're writing server code but you may be using the web sdk which is meant to be used client side. As such, the session is not persisting.
![](https://cdn.discordapp.com/avatars/462046107556511744/504fd808296728e8e89d82b8ea1e77a9.webp)
For server side auth, please see https://appwrite.io/docs/products/auth/server-side-rendering
Recommended threads
- redirect_uri_mismatch in Google OAuth2
Hi all. I'm hosting my appwrite on my own VPS but I', having trouble creating a session for an authenticated user via gmail. When I run the appwrite endpoint wi...
- Private identifiers are only available w...
Hello folks, hope you all doing fine. Have any of you faced the error below? ```sh node_modules/node-appwrite/dist/id.d.ts:2:5 - error TS18028: Private iden...
- Graceful Error Handling with account.get...
Dear community, as I understood the best way to check for an active session is account.get() and if it returns an 401 there is no active session. Now I would pr...
![](/images/bgs/pre-footer.png)