the-road-to-graphql / fullstack-apollo-express-postgresql-boilerplate

💥 A sophisticated GraphQL with Apollo, Express and PostgreSQL boilerplate project.
https://roadtoreact.com
MIT License
1.2k stars 261 forks source link

fix x-token header #14

Closed thomasjfox1 closed 6 years ago

thomasjfox1 commented 6 years ago

Fixes issue where if you are not logged in and there is no token, the server will read an empty token as the string 'null'. This causes errors to be thrown. Taking the localStorage token out of a template string fixes this issue. If there is no token (with no actively logged-in user) it will be an empty string, which line 22 of server/src/index.js interprets correctly.

rwieruch commented 6 years ago

Good point. Thanks!

mdmasumbillah commented 5 years ago

@rpweb I want only apollo server side. But how to set x-token after signin for auth. I did not used apollo client. When signin than get a token but req.headers.x-token is undefined. How solved this problem?