HeathH
Convex Community17mo ago
13 replies
Heath

Setting auth from within an HTTP action

I am using navigator.sendBeacon() to call an HTTP action on page unload, which in turn uses runMutation() to call one of my mutations. This generally works ok, but sendBeacon() cannot be configured to send headers like Authorization. I can pass the JWT via the POST body, but once I receive it within the HTTP action I am not sure how to then configure convex to use this JWT, to somehow call my runMutation with the JWT context, or to otherwise validate the JWT and extract my user information so that my mutation can work properly.
Was this page helpful?