
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
TypeScript
"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'
};
}
}
TL;DR
Issue: Developers are facing login problems on IOS using `account.createEmailPasswordSession(email, password)` or `account.createSession(userId, secret)` with an `Error load failed`. Works fine on Windows and Android.
Solution: The problem lies in the application's code for IOS. Developers need to review their JavaScript code for any IOS-specific issues causing the login error. Recommended threads
- Dumb question, api key for app? Protect ...
I have my project set up, and I'm developing with Flutter. My app does not require users to log in to retrieve some general project data, but authentication is ...
- OAuth2 Giving 404
I am trying to implement oauth2 with Google, but it keeps giving this weird 404 error.
- Safe Approach to Bucket
Hello, This is my utility function for obtaining the users' avatar url. Is this a safe approach to the problem? I am also unsure about ending the url with `&mod...
