Hi, nice to meet you! Apologies in advance, as I’m new to Appwrite and currently migrating from Firebase.
In my current project, I’m using PHP with Laravel, and I’m implementing user authentication system (Login and Logout). However, I seem to have missed something, as I encountered an error during the logout process:
(role: applications) missing scope (account)
.
I’d greatly appreciate your help in identifying where I might have gone wrong. Here, I’ve included the code for both Login and Logout.
Thank you so much in advance for your support, and I'm sorry for taking up your time.
are you using the same Client
instance in the method params or creating a new one?
Oh, I forgot to include the code for $client in Laravel's AppServiceProvider. Here's the code attached.
Assuming this is a singleton that is consistent across the entire session, it seems okay. I am also assuming the setSession('user')
is either a placeholder or do you do some data injection there? As it needs to be the user session and not just user
.
I am not entirely sure but (role: applications) missing scope (account)
already means that the user is not signed in. Does this happen only on logout?
I’ve updated the code and removed the setSession('user') part, as it was just something I tried while troubleshooting the error.
This issue happens when I click Logout, and it seems like the session isn’t actually deleted. There was a point during my code adjustments where it redirected to the login page (as if it worked), but when I manually accessed the dashboard page, it allowed access (as if the session was still active).
Finally, when I rewrote the code from scratch, it didn’t work and resulted in the missing scope error that we’re currently discussing.
can you confirm if the user has session before deleting? maybe try account->get()
and print it? does it print the user info?
Ahh, I see. Let me try implementing it first and I’ll update the results here.
Hi, here are the results I got. It seems like the account isn’t actually logged in, right? I think I don’t fully understand how to authenticate users. Could the issue be with the login process? 😟
I think the issue might be the fact that you might are not using the session
on the client after login [setSession
]. You are using setKey
as well, not sure if its required. Refer - https://appwrite.io/blog/post/introducing-support-for-server-side-rendering, the example uses js/react but should give you an idea.
Recommended threads
- Simple Email/Password login results in a...
It is a simple cast error in session.dart file, below is the logs: E/flutter ( 6054): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: t...
- Google auth sign and login not working
I’m having issue with my google auth
- How to Ensure a User Can Only Leave One ...
Hi everyone, I'm working on a review system for my app using Appwrite, and I'm facing an issue with ensuring that a user can only leave one review per product....