Project created in React/Next.js, Appwrite version 1.6.0. Authentication works in all browsers except Safari (ios), where an attempt to connect to {endpoint}/v1/account returns a 404 error.
appwrite config:
TypeScript
import { Client, Account, Databases } from 'appwrite';
export const client : Client = new Client()
.setEndpoint('{ENDPOINT}/v1')
.setProject('6740b572003293f464c8');
export const account : Account = new Account(client);
login handle:
TypeScript
const handleLogin = async (e: React.FormEvent) => {
e.preventDefault();
setError(null);
try {
await account.deleteSessions();
} catch (e) {
}
try {
await account.createEmailPasswordSession(email, password);
window.location.replace(`/${params.locale}/app/dashboard`); // Redirect to dashboard after successful login
} catch (e) {
setError('Failed to login. Please check your credentials.');
console.error(e);
}
}; ```
it redirects me to this message:
```json
{"message":"The requested route was not found. Please refer to the API docs and try again.","code":404,"type":"general_route_not_found","version":"1.6.0"}
checking if user is logged in:
TypeScript
useEffect(() => {
const checkAuth = async () => {
try {
// Try to get the current user session
await account.get()
// If successful, user is logged in
router.push(`/${params.locale}/app/dashboard`)
} catch (error) {
// If there's an error, user is not logged in
router.push(`/${params.locale}/app/login`)
} finally {
setIsLoading(false)
}
}
checkAuth()
}, [router])
( OPTIONS /v1/account 404)
TL;DR
Developers are facing a 404 error on Safari when trying to connect to {endpoint}/v1/account using a React/Next.js project with Appwrite version 1.6.0.
Solution:
The issue might be related to the OPTIONS request method not being supported in the server configuration. Check the server configuration to ensure that it allows the OPTIONS method.Recommended threads
- Project restoration button in console
The project restore button in console is taking no effect, i have tried several times and still nothing, it gives same popup if i reload
- Auth not working
guys my appwrite auth isnt working? oauth works (Sign in with google n discord) i have 2 websites deployed where do i get help when i do sign in with email and ...
- Apple OAuth2 settings auto-disable every...
Hello, I'm on Appwrite 1.8.1 at the moment. I'm using on prod Apple Oauth and it keeps disabling itself every night. I don't know where to look for the solutio...