node.jshasura

How do I authenticate Hasura events or actions on my custom server endpoint


How do I ensure a request to a custom business logic endpoint came from my Hasura. I am building the custom logic on a node js server running on AWS EB.

For example how might I implement the below method?

app.post('/some-event-or-action', (req, res) => {
    if(authCheckThisCameFromMyHasura()){
        //execute
    }
}

Solution

  • text Add X-HASURA-ACTION-SECRET(you can give this name as you want) headers to hasura action as you want may be from env or jsut value then setup your middleware in nodejs and access header check whether its value is equal or not

    ask me if any problem