Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Authentication #157

Open
wzalazar opened this issue Apr 15, 2019 · 4 comments
Open

Support Authentication #157

wzalazar opened this issue Apr 15, 2019 · 4 comments
Labels

Comments

@wzalazar
Copy link
Member

https://www.apollographql.com/docs/apollo-server/features/authentication

@rodrigooler
Copy link

@wzalazar in this feature will contain the context implementation also correct?

@wzalazar
Copy link
Member Author

wzalazar commented Jul 3, 2019

@rodrigooler yes, I think is just add the context option. If you want you can contribute to this feature...

The best way to start with that is to create a functional test, for example:

https://github.com/graphitejs/server/blob/master/test/functional/mutation.js

where Graphite could receive the context option

const context = ({ req }) => {
   // get the user token from the headers
   const token = req.headers.authorization || '';
  
   // try to retrieve a user with the token
   const user = getUser(token);
  
   // add the user to the context
   return { user };
 }

const graphite = await Graphite({ models: [Developer], context })

btw, you can run the functional test with this command

npm run test:functional

@wzalazar
Copy link
Member Author

wzalazar commented Jul 3, 2019

if you start with this issue and you have doubts or problems, ping me!

@rodrigooler
Copy link

@wzalazar this problem seems very simple. I am just trying to reconcile with my coding schedule and I will do the PR with the implementation and also discuss some possible points of improvement in the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants