Hi,
I am facing issue with login when I use account.createEmailPasswordSession(email, password) or account.createSession(userId, secret) . Error load failed
everything is working good on windows and Android. the only issue is with IOS. attached is the console log from chrome browser on anrdoid and IOS. and below is my code
"use client";
import { Client, Account } from "node-appwrite";
import { generateJWT } from "@/lib/cms/server/jwt";
export async function createSSOSession(userId, secret) {
try {
const adminClient = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_CMS_ENDPOINT)
.setProject(process.env.NEXT_PUBLIC_CMS_PROJECT_ID)
.setKey(process.env.NEXT_PUBLIC_CMS_API_KEY);
const account = new Account(adminClient);
console.log("session0: ", "session0");
console.log("userId: ", userId);
console.log("secret: ", secret);
const session = await account.createSession(userId, secret);
console.log("session1", session);
await generateJWT(session);
return {
success: true,
data: session
};
} catch (error) {
console.error("SSO login error0:", error.message);
return {
success: false,
error: error.message || 'Failed to login with SSO'
};
}
}
export async function createCredentialsSession(email, password) {
try {
const adminClient = new Client()
.setEndpoint(process.env.NEXT_PUBLIC_CMS_ENDPOINT)
.setProject(process.env.NEXT_PUBLIC_CMS_PROJECT_ID)
.setKey(process.env.NEXT_PUBLIC_CMS_API_KEY);
const account = new Account(adminClient);
const session = await account.createEmailPasswordSession(email, password);
await generateJWT(session);
return {
success: true,
data: session
};
} catch (error) {
return {
success: false,
error: error.message || 'Failed to login with email and password'
};
}
}
Recommended threads
- How can I disable client-side account re...
Hi everyone! I’m currently building a game backend using Appwrite, and I’d like to prevent users from creating new accounts directly through the client. My go...
- Custom domain for Google Auth
Hello! I connected my custom domain to my Appwrite project, but I can't get the Google login/consent screen to show my domain instead of the Appwrite domain. I...
- relationships bug or error idk
hey every one, am using am using appwrite on a project and ran into a problem where by created a relationship and two way to be specific and it is stuck on proc...