Skip to content

Instantly share code, notes, and snippets.

View Nospamas's full-sized avatar

Nospamas

  • Victoria, BC
  • 01:05 (UTC -07:00)
View GitHub Profile
@Nospamas
Nospamas / PassportService.ts
Last active February 23, 2017 02:48
GraphQL authentication via facebook-token
export class PassportService {
static async authFacebook(accessToken: string, context: IKoaContext) {
// seems to be the easiest way to get the facebook token into the auth library
// could also be passed as a faked body or query string parameter
context.request.header.access_token = accessToken
try {
let returnUser: any = null;
// its easier to use the user returned in a callback than try to promisfiy
// this function
await Passport.authenticate(