github authentication middleware implementation