Skip to content
This repository has been archived by the owner on May 16, 2019. It is now read-only.

How would I handle query/mutation authentication? #44

Closed
pqt opened this issue Dec 21, 2018 · 4 comments
Closed

How would I handle query/mutation authentication? #44

pqt opened this issue Dec 21, 2018 · 4 comments

Comments

@pqt
Copy link

pqt commented Dec 21, 2018

Hey!

First of all, I want to thank you @pgutkowski for making this, it's been a great help in working with GraphQL and Kotlin, taking away a lot of the headaches I was running into before finding this.

Overall my implementation went fairly smooth. I am able to resolve queries and mutations accurately and even have registration for an app completely done.

My problem now though, is trying to blend Ktor's JWT and specific queries/mutations together.

I can protect the graphql route entirely , but that doesn't work well for th registration and login process.

I know there's a context variable on schema.execute but I'm not certain if this is how I should be passing authentication data down stream.

@pqt pqt changed the title How would I handle authentication? How would I handle query/mutation authentication? Dec 21, 2018
@pgutkowski
Copy link
Owner

Hey @pqt!

I'm happy that you find KGraphQL useful! You are right - context is meant to be container for authorization data. Unfortunately, it has limitations: you can only use it in root level queries and mutations, see #42. I hope I will find time soon to extend context variable access to properties.

I'm sorry it took me so long to respond.

@NataliiaVallander
Copy link

Thanks a lot for making this project! Really cool and useful!
And I also want to vote for this feature: it would be really useful if it would be possible access context from resolver!!!

@pqt
Copy link
Author

pqt commented Jan 10, 2019

I ended up actually having to put the prototype on hold (for now) because of this limitation, but I still think you've got a great project here!

@NataliiaVallander
Copy link

I ended up actually having to put the prototype on hold (for now) because of this limitation, but I still think you've got a great project here!

@pqt , have you mentioned the last answer here: #42 ?
Actually you can access context! Works for me!

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

No branches or pull requests

3 participants