feat: Authentication token refresh logic

This commit is contained in:
2026-03-26 15:46:53 -04:00
parent 30c7b8b0b5
commit d758f53176
4 changed files with 58 additions and 6 deletions

View File

@@ -2,10 +2,10 @@ import { defu } from "defu";
export default defineRemoteExecutorHooks({
onRequest(request, context) {
// Attach the Authorization header if a wpAuthToken is present in the context
if (context?.wpAuthToken) {
// Attach the Authorization header if an authToken is present in the context
if (context?.authToken) {
request.extensions = defu(request.extensions, {
headers: { Authorization: `Bearer ${context.wpAuthToken}` },
headers: { Authorization: `Bearer ${context.authToken}` },
});
}
},