Thoufiq Uchiha🥷👨💻
Hello please help me solve this This is auth.js
TypeScript
import conf from "../conf/conf.js"
import { Client, Account, ID } from "appwrite";
export class AuthService {
client = new Client();
account;
constructor(){
this.client
.setEndpoint(conf.appwriteUrl)
.setProject(conf.appwriteProjectId)
this.account = new Account(this.client)
}
async createAccount({email, password, name}){
try {
const userAccount = await this.account.create(ID.unique(), email, password, name)
if (userAccount) {
return login({email, password})
} else {
return userAccount
}
} catch (error) {
throw error
}
}
async login({email, password}){
try {
return await this.account.createEmailSession(email, password)
} catch (error) {
throw error
}
}
async getCurrentUser(){
try {
return await this.account.get()
} catch (error) {
console.log("Appwrite service :: getCurrentUser() :: ", error)
}
return null
}
async logout(){
try {
await this.account.deleteSessions()
} catch (error) {
console.log("Appwrite service :: logout() :: ", error)
}
}
}
const authService = new AuthService()
export default authService
TL;DR
AppwriteException: User (role: guests) missing scope (account);
Developer is seeking help with solving an issue in their auth.js file. The AuthService class is missing the necessary scope for a guest user. The createAccount function seems to be calling a login function that is not defined.
Solution: Add the missing scope for the guest role in the auth.js file. Ensure the login function is properly defined and called within the createAccount function. Recommended threads
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- Error: User (role: guests) missing scope...
I want to send a verification code to the user and the given phone number and check it and create a session right after the user entered the secret. For me that...
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...