© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•6mo ago•
24 replies
Muezz

Hook requires authorization token

I think it is not relevant but just for context I am setting up password-less auth using magic links in my project.

I have a custom auth hook in my local running instance for sending emails.

I am getting this following error:
[NEXT] Unknown error occurred: Error [AuthApiError]: Hook requires authorization token
[NEXT]     at handleError (../../../src/lib/fetch.ts:102:9)
[NEXT]     at async _handleRequest (../../../src/lib/fetch.ts:195:5)
[NEXT]     at async _request (../../../src/lib/fetch.ts:157:16)
[NEXT]     at async SupabaseAuthClient.signInWithOtp (../../src/GoTrueClient.ts:976:27)
[NEXT]     at async (src/server/api/routers/auth.ts:47:25)
[NEXT]     at async (src/server/api/trpc.ts:122:18)
[NEXT]   45 |     .mutation(async ({ input }) => {
[NEXT]   46 |       const sp = await createClient();
[NEXT] > 47 |       const { error } = await sp.auth.signInWithOtp({
[NEXT]      |                         ^
[NEXT]   48 |         email: input.email,
[NEXT]   49 |         options: {
[NEXT]   50 |           emailRedirectTo: env.NEXT_PUBLIC_SITE_URL, {
[NEXT]   __isAuthError: true,
[NEXT]   status: 500,
[NEXT]   code: 'unexpected_failure'
[NEXT] }
[NEXT] ❌ tRPC failed on auth.loginWithMagicLink with input {"email":"my_email@gmail.com"}: Something went wrong
[NEXT] [TRPC] auth.loginWithMagicLink with input {"email":"my_email@gmail.com"} took 1236ms to execute
[NEXT]  POST /api/trpc/auth.loginWithMagicLink?batch=1 500 in 1349ms
[NEXT] Unknown error occurred: Error [AuthApiError]: Hook requires authorization token
[NEXT]     at handleError (../../../src/lib/fetch.ts:102:9)
[NEXT]     at async _handleRequest (../../../src/lib/fetch.ts:195:5)
[NEXT]     at async _request (../../../src/lib/fetch.ts:157:16)
[NEXT]     at async SupabaseAuthClient.signInWithOtp (../../src/GoTrueClient.ts:976:27)
[NEXT]     at async (src/server/api/routers/auth.ts:47:25)
[NEXT]     at async (src/server/api/trpc.ts:122:18)
[NEXT]   45 |     .mutation(async ({ input }) => {
[NEXT]   46 |       const sp = await createClient();
[NEXT] > 47 |       const { error } = await sp.auth.signInWithOtp({
[NEXT]      |                         ^
[NEXT]   48 |         email: input.email,
[NEXT]   49 |         options: {
[NEXT]   50 |           emailRedirectTo: env.NEXT_PUBLIC_SITE_URL, {
[NEXT]   __isAuthError: true,
[NEXT]   status: 500,
[NEXT]   code: 'unexpected_failure'
[NEXT] }
[NEXT] ❌ tRPC failed on auth.loginWithMagicLink with input {"email":"my_email@gmail.com"}: Something went wrong
[NEXT] [TRPC] auth.loginWithMagicLink with input {"email":"my_email@gmail.com"} took 1236ms to execute
[NEXT]  POST /api/trpc/auth.loginWithMagicLink?batch=1 500 in 1349ms


Here is the relevant section in my
config.toml
config.toml
file:
[auth.hook.send_email]
enabled = true
# Uncomment this line and comment the next line to use local development hook
uri = "http://host.docker.internal:3000/api/v2/public/emails/supabase"
# uri = "https://dashboard.my_project.io/api/v2/public/emails/supabase"
secrets = "env(SEND_EMAIL_HOOK_SECRET)"
[auth.hook.send_email]
enabled = true
# Uncomment this line and comment the next line to use local development hook
uri = "http://host.docker.internal:3000/api/v2/public/emails/supabase"
# uri = "https://dashboard.my_project.io/api/v2/public/emails/supabase"
secrets = "env(SEND_EMAIL_HOOK_SECRET)"


What could be the reason for this? The error goes away if I remove the auth hook.
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
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Hook requires authorization token
SupabaseSSupabase / help-and-questions
2mo ago
Custom Auth Token Hook requires authorization token
SupabaseSSupabase / help-and-questions
8mo ago
SUPABASE: Custom auth hook - GOTRUE_HOOK_CUSTOM_ACCESS_TOKEN_SECRET
SupabaseSSupabase / help-and-questions
13mo ago
`custom_access_token_hook` exluded on diff
SupabaseSSupabase / help-and-questions
6mo ago