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 to get current user account session ...
i am using sveltekit and i'm a bit unclear on how to get the current user's session from the server side. thisi s what i have so far // src/lib/server/appwrite...
- Realtime: Email Verification Not work
There are some issues with real-time updates. For email verification, updates triggered by the console will be checked, but real-time updates are not triggered ...
- Rate límit reset
I've made an error in the code by not setting a limit on how much rows should i get per request because i was working with a small db for testing. Last night Iv...