graphql-devise / graphql_devise

GraphQL interface on top devise_token_auth
MIT License
197 stars 36 forks source link

how to set current_resource for both authenticated and unauthenticated fields #227

Closed NathanielAwoke closed 1 year ago

NathanielAwoke commented 2 years ago

Question

current_resource is set only when the field is defined as an authenticated field, is there any way to set the current_resource for unauthenticated fields also, given the proper auth headers are set in the request ?

field :listings, Types::ListingType, authenticate: true -> current resource is accessible here field :listings, Types::ListingType, authenticate: false -> current resource is not available, even though the proper headers are set in the request.

00dav00 commented 2 years ago

Hi @NathanielAwoke , have you checked if this method is reached?

You need to make sure that the controller you are using includes this concern so gql devise can use DTA to set the user by token.

I'm curious about the use case you are dealing with here. Do you mind expanding a little bit more on your idea?