0.2.9 • Published 4 years ago

@pointblankdev/lambda-auth v0.2.9

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

lambda-auth

Usage

Use lambda-auth to verify() RS256 JWTs and decode their accessToken.

const { verify } = require('@pointblankdev/lambda-auth');

const server = new ApolloServer({
  schema: buildFederatedSchema([{ typeDefs, resolvers }]),
  context: async ({ event, context }) => {
    return {
      headers: event.headers,
      functionName: context.functionName,
      event,
      context,
      user: await verify(event),
    };
  },
  playground: {
    endpoint: `/${process.env.ENV}/graphql`,
  },
  introspection: true,
});

Notes

The verify function is asynchronous so you can either await the function like it's been done above or await context.user whenever you want to access it

0.2.9

4 years ago

0.2.8

4 years ago

0.2.7

4 years ago

0.2.6

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.3

4 years ago

0.2.2

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago