rootOriginal post
Web Developer
server side script
JavaScript
async function verifyJWT(token) { if (!token) throw new Error("No JWT token provided"); try { const res = await axios.get(`${ENDPOINT}/account`, { headers: { "X-Appwrite-Project": PROJECT_ID, "Authorization": `Bearer ${token}`, }, }); return res.data; } catch (err) { console.error("Failed to fetch account data:", err.response?.data || err.message); throw new Error("Invalid JWT or unable to fetch account"); }}JavaScript
Failed to fetch account data: { message: 'User (role: guests) missing scope (account)', code: 401, type: 'general_unauthorized_scope', version: '1.8.0'}Socket auth failed: Invalid JWT or unable to fetch account~ client side is logged in
~ method of getting jwt below
JavaScript
const jwtResponse = await account.createJWT();Summary
Developers are trying to get an account using a JWT but are facing a 401 error related to missing scope 'account'. The issue lies with the user role not having the necessary scope. The solution would be to update the user's role to include the 'account' scope.