
while implementing login signup functionality using appwrite I am getting invalid URL error in appwrite. I am also attaching the ss of it below for reference. It will be of great help if someone can help me debug this

can u post the code here in text?

yes sure

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 this.loginAccount({email,password}) } else{ return userAccount } } catch(error){ throw error } } async loginAccount({email,password}){ try{ return await this.account.createEmailPasswordSession(email,password); } catch(error){ throw error } } async getCurrentUser(){ try{ return await this.account.get() } catch(error){ console.log("Appwrite servce :: getCurrentUser():: ",error) } return null } async logout(){ try{ return await this.account.deleteSessions(); } catch(error){ console.log("Appwrite servce :: logout():: ",error) } }
};
// import { Client, Account, ID } from "appwrite";
// const client = new Client() // .setEndpoint('https://cloud.appwrite.io/v1') // .setProject('<PROJECT_ID>');
// const account = new Account(client);
const AuthServiceObj=new AuthService() export default AuthServiceObj;

this is the code of the Auth file

@chiranjeev pls use three backticks to format and post

ok sir

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 this.loginAccount({email,password})
}
else{
return userAccount
}
}
catch(error){
throw error
}
}
async loginAccount({email,password}){
try{
return await this.account.createEmailPasswordSession(email,password);
}
catch(error){
throw error
}
}
async getCurrentUser(){
try{
return await this.account.get()
}
catch(error){
console.log("Appwrite servce :: getCurrentUser():: ",error)
}
return null
}
async logout(){
try{
return await this.account.deleteSessions();
}
catch(error){
console.log("Appwrite servce :: logout():: ",error)
}
}
};
// import { Client, Account, ID } from "appwrite";
// const client = new Client()
// .setEndpoint('https://cloud.appwrite.io/v1')
// .setProject('<PROJECT_ID>');
// const account = new Account(client);
const AuthServiceObj=new AuthService()
export default AuthServiceObj;
Recommended threads
- Getting issue while migrating from Self ...
i try to migrating my project but when do this error come and dont allow to crate that migration
- Pending upload some file, but not for ot...
When upload this file, always got pending. But when I upload another file, it works. Why?
- Need help setting up this error is showi...
You can't sign in to this app because it doesn't comply with Google's OAuth 2.0 policy. If you're the app developer, register the redirect URI in the Google Cl...
