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

50 Views Asked by At

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
    }
}
1

There are 1 best solutions below

0
Bete Goshme On BEST ANSWER

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