How did you upload the
magic-sdkmodule to your realm application?
in a empty directory, i run
npm install --save @magic-sdk/admin
tar -czf node_modules.tar.gz node_modules/
i uploaded the node_modules.tar.gz package to Realm over the UI. I see this under the Dependencies Tab:
and how do you run the custom function auth?
import { Magic } from 'magic-sdk';
const m = new Magic('API_KEY');
async function loginWithMagic() {
try {
const didToken = await m.auth.loginWithMagicLink({ email: 'hello@example.com', showUI: false });
const credentials = Realm.Credentials.function(didToken);
const user = await app.login(credentials);
return user;
} catch {
// Handle errors if required!
}
}
Can you use an API call to an ADMIN interface instead of uploading code?
i will try that
Perhaps cosider using an alternative like Auth0 API for magic links.
Magic.link use a blockchain to offer a dezentralised authentication flow. That’s higher secure as storing tokens, user data and so on in a single database. I don’t know, how secure is Auth0, but it is expensive as far as I know or what are your experiences in this regard?
Passportjs is also a very popular auth library for Nodejs. Is this already supported by Realm Functions? Do you know of any other passwordless authentication alternatives that work well with Realm? it might be helpful if Realm itself offered such a login method ![]()