Example for Apollo Server 2 with Passport.js
See original GitHub issueI 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:
- Created 5 years ago
- Reactions:3
- Comments:7
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
After a while and reading the actual source code I understood the concept of the
apollo-server
package, it’s just a wrapper aroundapollo-server-express
, it’s pretty much agraphql-yoga
. The thing is that if you want to use middleware you actually have to useapollo-server-express
asapollo-server
doesn’t have theapplyMiddleware
anymore.I really liked your example, I’m trying to implement
passport
+passport-jwt
.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