question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example for Apollo Server 2 with Passport.js

See original GitHub issue

I tried to find the internet for a tutorial using Apollo Server 2 with Passport.js and I couldn’t find, perhaps because it’s new and people are still using apollo-server-express. It’s really confusing for me and that is why I’m asking for you guys is there’s somewhere I can find a tutorial for that.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

3reactions
hasusozamcommented, Sep 17, 2018

After a while and reading the actual source code I understood the concept of the apollo-server package, it’s just a wrapper around apollo-server-express, it’s pretty much a graphql-yoga. The thing is that if you want to use middleware you actually have to use apollo-server-express as apollo-server doesn’t have the applyMiddleware anymore.

I really liked your example, I’m trying to implement passport + passport-jwt.

2reactions
hasusozamcommented, Sep 18, 2018

I’m trying, but it’s not as I want it to be, at least not yet.

This is my implementation so far, but I don’t to make the endpoint closed as it is, I want to make it open and check if there’s a user in the context.

https://github.com/apollographql/apollo-server/issues/1685

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authentication and Authorization with GraphQL and Passport
Create a new file api/typeDefs.js and add the following code. import { gql } from 'apollo-server-express';.
Read more >
Apollo Server with PassportJS example? : r/node - Reddit
I've got a NextJS app on the frontend with Apollo Client, and a Prisma/Apollo Server backend connected to a Postgres db. I nearly...
Read more >
Authentication and authorization - Apollo GraphQL Docs
The example below extracts a user token from the HTTP Authorization header included in ... JavaScript. 1. import { ApolloServer } from '@apollo/server';....
Read more >
How to setup authentication with graphql, and passport but ...
In the example code below you can see the Promise getUser , which does the passport authentication, being used in the Context of...
Read more >
Passport JWT with GraphQL (Apollo Server 2)
import express from 'express' import { ApolloServer } from 'apollo-server-express' // ... import passport from 'passport' import passportJWT ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found