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:
Here is the relevant section in my
What could be the reason for this? The error goes away if I remove the auth hook.
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 1349msHere is the relevant section in my
config.tomlconfig.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.