Skip to content

Instantly share code, notes, and snippets.

View stctheproducer's full-sized avatar

Chanda Mulenga stctheproducer

View GitHub Profile
@stctheproducer
stctheproducer / asynForEach.js
Last active December 17, 2020 16:33
A JavaScript asyncronous forEach function to use when working with asynchronous functions and arrays
export const async function asyncForEach(array, callback) {
for (let index = 0; index < array.length; index++) {
await callback(array[index], index, array)
}
}
@stctheproducer
stctheproducer / AuthController.js
Last active July 6, 2020 19:07
I am getting an error in which my auth session is saved in redis but doesn't seem to be propagated to rest of the application. I am using FusionAuth as my authentication server. Below are my files including their configurations.
async authorize({ request, response }) {
const { response_type } = request.get()
try {
// Check if OAuth flow is Authorization Code Grant Request
if (response_type !== Env.get('OAUTH2_FLOW_TYPE')) {
response.badRequest()
}
// Redirect to FusionAuth