
I am getting this error while trying to use auth in appwrite: Project with the requested ID could not be found. Please check the value of the X-Appwrite-Project header to ensure the correct project ID is being used.
My code:
`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 this.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 serive :: getCurrentUser :: error", error);
}
return null;
}
async logout() {
try {
await this.account.deleteSessions();
} catch (error) {
console.log("Appwrite serive :: logout :: error", error);
}
}
}
const authService = new AuthService();
export default authService`
I am doing const userData = await authService.createAccount(data)
in another file to create account. Please forgive me if it is some trivial error as I am a newbie, also please dont delete this if it breaks any rule.
Recommended threads
- Unable to get account or logout after a ...
I get the following error after a successful login when ever I call account.get() or account.deleteSession(sessionId: "current"). User (role: guests) missing sc...
- [AppwriteException: User (role: guests) ...
User signs in succesfully but after when trying to get currentuser i get the error above. It has been working for month with a user. now i implemented signup a...
- need help
i make website and try add the phone sms otp and its work but while test after 10 times i think its give me this message Phone authentication limit for your org...
