
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
- why the createOAuth2Token method does no...
I need it to get secret and key, how to get in flutter code?
- Flutter Google Auth - the redirect url i...
If I don't set the success url return, the redirect goes to https://cloud.appwrite.io and the loading is forever
- AppwriteException: , Invalid OAuth2 Resp...
I am getting this error when returning to app from google oauth2
