Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fix: Typescript example
Browse files Browse the repository at this point in the history
  • Loading branch information
wtrocki committed Jun 2, 2020
1 parent 2ad2cc0 commit d22c695
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/basic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const { keycloak } = configureKeycloak(app, graphqlPath)
// Ensure entire GraphQL Api can only be accessed by authenticated users
app.use(graphqlPath, keycloak.protect())
app.use(cors());
const typeDefs = gql`
const typeDefs = `
type Query {
hello: String @hasRole(role: "developer")
}
Expand All @@ -39,11 +39,12 @@ const resolvers = {

const server = new ApolloServer({
typeDefs: [KeycloakTypeDefs, typeDefs],
schemaDirectives: KeycloakSchemaDirectives,
// See https://github.com/ardatan/graphql-tools/issues/1581
schemaDirectives: KeycloakSchemaDirectives as any,
resolvers,
context: ({ req }) => {
return {
kauth: new KeycloakContext({ req })
kauth: new KeycloakContext({ req : req as any })
}
}
})
Expand Down

0 comments on commit d22c695

Please sign in to comment.