© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
2 replies
Vincent

Magic Email Links and CDN

I figured I'd give supabase a try locally. I have the following code:

<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>

email
<input type="text" id="email">
<button onclick="signInWithEmail()">signin</button>

<script>
const SUPABASE_KEY = 'xxx'
const SUPABASE_URL = "yyy"
const client = supabase.createClient(SUPABASE_URL, SUPABASE_KEY);

async function signInWithEmail() {
  console.log(`Trying to log in ${document.getElementById("email").value}`)
  const { user, error } = await client.auth.signIn({
    email: document.getElementById("email").value
  })
  console.log(user);
  console.log(error);
}
</script>
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js"></script>

email
<input type="text" id="email">
<button onclick="signInWithEmail()">signin</button>

<script>
const SUPABASE_KEY = 'xxx'
const SUPABASE_URL = "yyy"
const client = supabase.createClient(SUPABASE_URL, SUPABASE_KEY);

async function signInWithEmail() {
  console.log(`Trying to log in ${document.getElementById("email").value}`)
  const { user, error } = await client.auth.signIn({
    email: document.getElementById("email").value
  })
  console.log(user);
  console.log(error);
}
</script>


This is hosted on localhost:8000 and supabase is configured to send a magic link with a re-direct. The redirect works ... I briefly see extra info in the URL, but how does the user actually get authenticated? The docs (https://supabase.com/docs/guides/auth/auth-magic-link) suggest that I merely need to call
.auth.signIn
.auth.signIn
but that's the same method that I used to send the email?

Is there an example of basic email authentication that uses vanilla JS with supabase hosted via CDN.
Login With Magic Link | Supabase
Use Supabase to Authenticate and Authorize your users using Magic Link.
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Magic Links and OTP
SupabaseSSupabase / help-and-questions
4w ago
Issues with Magic Links
SupabaseSSupabase / help-and-questions
4y ago
Magic link email
SupabaseSSupabase / help-and-questions
4y ago
Email signup with 6-digit OTP verification instead of magic links?
SupabaseSSupabase / help-and-questions
3mo ago