Skip to content

How to authenticate webhooks? #14115

Answered by foxted
mmkal asked this question in Questions
May 4, 2023 · 8 comments · 25 replies
Discussion options

You must be logged in to vote

Not too familiar with Deno (that's why I went with a Nest.js API instead), but a quick Chat-GPT conversation gives me something like this:

import { createHmac } from "https://deno.land/std/hash/mod.ts";

const supabaseWebhookConfig = {
  webhookConfig: {
    headerName: "x-supabase-signature",
    secret: "your-secret-key",
  },
};

async function validateSupabaseWebhook(req) {
  if (!supabaseWebhookConfig.webhookConfig) {
    console.warn(
      "Supabase Webhook Guard is not configured. Please check your SupabaseModule configuration."
    );
    return false;
  }

  const headerName = supabaseWebhookConfig.webhookConfig.headerName ||
    "x-supabase-signature";
  const signature = req.h…

Replies: 8 comments 25 replies

Comment options

You must be logged in to vote
1 reply
@olee
Comment options

Comment options

You must be logged in to vote
6 replies
@yaronguez
Comment options

@yaronguez
Comment options

@borispoehland
Comment options

@yaronguez
Comment options

@skorfmann
Comment options

Comment options

You must be logged in to vote
8 replies
@therealpurplemana
Comment options

@therealpurplemana
Comment options

@therealpurplemana
Comment options

@foxted
Comment options

Answer selected by encima
@jibin2706
Comment options

@jibin2706
Comment options

@arjunacharya10
Comment options

Comment options

You must be logged in to vote
8 replies
@encima
Comment options

@ChuckJonas
Comment options

@encima
Comment options

@ChuckJonas
Comment options

@gc-ft
Comment options

Comment options

You must be logged in to vote
1 reply
@njoshi22
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@elyobo
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment