accounts-js / graphql

GraphQL transport for accounts suite
MIT License
26 stars 10 forks source link

Is it possible to make this work with graphql-compose? #25

Open MetaCorp opened 6 years ago

MetaCorp commented 6 years ago

Hey, I've been trying to use accounts-js with graphql-compose but can't find a way to make it work. Can you guys give me an example, or some advice?

davidyaha commented 6 years ago

Hey @MetaCorp!

Thanks for taking interest in this project! I am not familiar with graphql-compose.

Could you explain what it deos and how exactly you would like to use accounts-js?

Currently the @accoutns/graphql-api package will expose a class that extends a schema using makeExecutableSchema from graphql-tools. There is an example in the readme file of the graphql-api package.

Let me know how it goes!

MetaCorp commented 6 years ago

I would like to use accounts-js to have an authentification with password at first, to make some data only accessible for connected client.

graphql-compose can generate graphql resolvers from schemas, I've been testing it recently and really enjoyed that lib, and it comes with great plugins. I'm using graphql-compose-mongoose to generate resolvers from mongoose schemas.

I found a way to extend graphql-compose resolvers using mergeSchemas() from graphql-tools. This example from graphql-compose.

So i have access to account-js resolvers but they throw errors. When trying with createUser I have this: GraphQLError: Cannot read property 'emit' of undefined.

I'm doing my testing on this repo. Maybe you can help me here.