
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
- Flutter native Google Sign Up with googl...
Hey I want to use the native login instead of the WebView. Do you have any experience on that and has Appwrite to plan this support?
- 404 for self-host
docker-compose.yml: x-logging: &x-logging logging: driver: 'json-file' options: max-file: '5' max-size: '10m' services: traefik: ima...
- Is p-limit compatible with Appwrite?
I have a function that makes asynchronous calls to different Appwrite collections. This is how I make the call: ```js await Promise.allSettled([ ...
