The Problem:
The code bellow throws a Unhandled Runtime Error Error: Magic RPC Error: [-32603] Internal error: Unsupported Magic Connect method
and I cannot figure out why.
node version : 18.12.1
magic-sdk version: ^8.1.1
nextjs13
import { Magic } from 'magic-sdk';
const magic = new Magic(process.env.NEXT_PUBLIC_MAGIC_PUBLISHABLE_KEY);
try {
magic.auth.loginWithMagicLink({ email });
const didToken = await magic.auth.loginWithMagicLink({
email,
});
console.log({ didToken });
}
} catch (error) {
console.log(error);
}
I have tried downgrading the magic-sdk
version to 8.1.1
with node version
to 18.12.1
but the problem still persists
The expected behavior is for the code to send a magic link
to the users email and the user should use that magic link
to login into the application
2
Answers
You probably might have created a "Magic Connect" app instead of a "Magic Auth" app.
You did same mistake which I did.
check this image : magic auth vs connect
You should created a Magic Auth app instead of Magic Connect.
Once new app is created, new API key will be visible on the magic website. You can see all of yours apps in the Dashboard.
Replace the old API Key with the new one.
Restart your server.