I'm developing my Godot game using Apwwrite. I use Appwrite's REST API. I can login successfully and retrieve a session id but when I call delete session and attaching the session_id in the headers and endpoint I'm getting the following error: {"message":"User (role: guests) missing scope (account)","code":401,"type":"general_unauthorized_scope","version":"1.6.2"}
This is my function in GDScript: func logout(session_token: String) -> void: print("[UserNetwork] Attempting to delete all sessions")
var headers = [
"X-Appwrite-Response-Format: 1.6.0",
"X-Appwrite-Project: " + _PROJECT_ID,
"Content-Type: application/json",
"X-Appwrite-Session: " + session_token,
]
print("[UserNetwork] Headers for logout: ", headers)
var network_request = NetworkRequest.new()
network_request.set_url(_APPWRITE_ENDPOINT + "/account/sessions/" + session_token)
network_request.set_method(HTTPClient.METHOD_DELETE)
network_request.set_headers(headers)
var client = HTTPClient.new()
_network.execute(client, network_request, _on_logout_result)
func _on_logout_result(request_id: String, response_body, response_code, response_attached_params): print("[UserNetwork] Logout response received. Status code: ", response_code) print("[UserNetwork] Response body: ", response_body)
if response_code == 204:
_session_id_changes.on_next("")
_is_logged_in.Value = false
print("[UserNetwork] Logout successful")
else:
print("[UserNetwork] Logout failed with status code: ", response_code)
Basically I don't know how to make Appwrite recognize that the session id is associated with a valid user. Thanks in advance!
Recommended threads
- Bug report: Race condition in Flutter SD...
Hi team, I've found an intermittent bug in the Flutter SDK (v20.3.0) when using `createOAuth2Session` on Android. **Symptoms** After `createOAuth2Session` re...
- Register Disable
this is possible disable register but keep oauth login?
- how to access the value of account statu...