Skip to content
Advertisement

Tag: koa

Koa & Passport Missing credentials

I have a Koa server that uses Passport to authenticate users against an Array, and a React client. After successful login, the following requests are not authenticated as the cookie is undefined. The authenticate function’s error parameter has: After browsing the site, I fixed the usual errors, calling the returned function of authenticate, adding {credentials: ‘include’} to fetch etc, but

How to make koa ctx.throw() use application/json rather than text/plain

I have made a custom error handler for my koa app which works beautifully (except for one sticking point) – using ctx.throw() means any stacktrace is emitted to the server logs and also any custom error message is sent in the response. The one problem is that Content-Type header is text/plain but I really need it to be application/json. app.js:

How to run Generator Functions in Parallel?

Assuming I have a Koa web server with an endpoint like this: Now the client will get the respond after ALL the actions are performed obviously. but the things is each action is dependent on the completion of the previous. Is there a way to execute them in parallel? Note: Turning them to Promises is not an option, unless I

Advertisement