
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
- Sharing cookies
Hi, I’m using Appwrite Cloud, and I have a setup where my Appwrite backend is hosted on a subdomain (e.g., api.example.com), while my frontend (Next.js app) and...
- Flutter OAuth2 Google does not return to...
When the flow starts, the browser opens, I select an account, and it keeps showing: """ Page not found The page you're looking for doesn't exist. `general_rout...
- Organization not exists anymore
Hello! We have a problem with a cloud database. We are on the Free plan, but after a refresh the site wants me to create a new organisation, and I not see the c...
