Redirect to my site after a user clicks the magic link
The redirect URI is supported in Magic starting with magic-sdk version 2.6.0.
Pass in a redirectURI parameter to loginWithMagicLink which is where the user will get redirected to after clicking the magic link.
On the redirect page, call await magic.auth.loginWithCredential(); which will grab and return the DID token from the query parameters which you can then send to your backend to validate.
Check out our example app showing how it works.
Pass in a redirectURI parameter to loginWithMagicLink which is where the user will get redirected to after clicking the magic link.
const did = await magic.auth.loginWithMagicLink({
email,
redirectURI: `${window.location.origin}/callback`
});
On the redirect page, call await magic.auth.loginWithCredential(); which will grab and return the DID token from the query parameters which you can then send to your backend to validate.
Check out our example app showing how it works.
Updated on: 05/04/2021
Thank you!