Use the Auth token in your server-side (Nodejs Tested)
This middleware is created to be integrated with NodeJS + Express + Supabase
- Copy the file where you want inside your project
- Import the file into the route you need to validate
const supabase_middleware = require('../config/supabase_middleware')
- Invoke the middleware parsing
req
andres
:const {user,supabase} = await supabase_middleware(req,res);
- If the validation would be OK then you will get
user
andsupabase
, the user will contain the user details, supabase will be the istance with the current session to use for your next logical calls - If the validation would be KO then the middleware will automatically sent the error
- Login using the supabae.auth-signin
- Parse the
access_token
undercurrentSession
into Authentication: Bearer to your endpoint