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

GraphQL error : You must be logged in #25

Open
AymericBethencourt opened this issue Aug 6, 2019 · 3 comments
Open

GraphQL error : You must be logged in #25

AymericBethencourt opened this issue Aug 6, 2019 · 3 comments

Comments

@AymericBethencourt
Copy link
Contributor

This error is showing when accessing the boilerplate. I understand you must be logged in but it should not show as an error. Being logged out is normal state that should show the login and registration page without an error.
https://i.ibb.co/9TDpVPj/Screenshot-2019-08-06-at-10-26-03.png

@IgorMCesar
Copy link
Owner

I am trying to fix this on the new branch "fix/graphql-error-messages". I am still thinking what should be the right approach, prevent graphql errors on console or filter them in some way. Do you suggest any solutions?

@AymericBethencourt
Copy link
Contributor Author

=> Definitely preventing the graphql error in the first place.
You should be able to have graphql requests without being authenticated, for example to fetch data to display on the homepage of the app. For example reddit is fetching the latest articles and comments even though you are not logged in. It's only when you want to post something new that you have to log in, which by the way is I think the next step in your boilerplate, to have something like reddit to post articles and comments in order to really make it a useable boilerplate for any real application, even if people remove the articles and comments and replace them with the actual data of the applications. At least they will have an example of how to actually fetch data, with required authentication or not.
Btw I find this project very cool, I'm gonna help you develop it, I've already forked it and started working on the integration with redux-thunk as I saw it was on your todo list. I'll soon submit you a pull request :)

@IgorMCesar
Copy link
Owner

I think that's the right approach too. Request data without authentication is already implemented, I used directives for that. You can see this on server/graphql/schemas/user.js, @auth requires the user to be authenticated and @guest requires a not authenticated request, any other request will be accepted and won't throw an error.

I really appreciate the help! I was trying to maintain the project alone, but is very time consuming, your help is more than welcome =)

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

No branches or pull requests

2 participants