[Solved] Magic URL endpoint returns `501 Not Implemented` when in node environment
- 0
- Self Hosted
- Auth

Hi 🙂
I am trying to create a magic url token from the server side in nuxt
I am using the rest api since the node-appwrite
doesn't support Cloudflare pages/workers. When I call the endpoint /account/tokens/magic-url
but it returns "https://selfhosted-url/v1/account/tokens/magic-url": 501 Not Implemented
My selfhosted version is running the latest appwrite version 1.5.4
my code
import { type Models, type AppwriteException } from 'node-appwrite';
import { ofetch } from 'ofetch';
export default defineEventHandler(async (event) => {
const config = useRuntimeConfig(event);
const url = config.appwrite.endpoint;
const projectId = config.appwrite.projectId;
const { email } = await readBody<{ email: string }>(event);
const appUrl = config.public.app.url;
try {
const session = await ofetch<Models.Token>(`/account/tokens/magic-url`, {
baseURL: url,
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Appwrite-Project': projectId
},
body: {
email,
url: appUrl
}
});
return session;
} catch (error: any) {
console.log(error);
throw createError<AppwriteException>(error);
}
});
Thanks

[Solved] Magic URL endpoint returns 501 Not Implemented
when in node environment

I found my mistake, I did not pass the token with the permissions to create a session and the body is missing the userId
Recommended threads
- 404 errors after 7 Days
Local hosted Appwrite via docker. Last version and current version. After exactly 7 days Appwrite stops working. I get 404 route not found, cannot access anyth...
- unable to modify attribute
please help: when I try to modify attribute size or key or anything, I am getting this errors: ``` Deprecated: strtolower(): Passing null to parameter #1 ($str...
- Error 1.7.4 console team no found
In console when i go to auth, select user, select a membership the url not work. Only work searching the team. It is by the region. project-default- and i get ...
