Problem with signup and signin #9
Replies: 2 comments
-
I think this state occurs if you delete all cookies -> you have deleted any stored JSON tokens. |
Beta Was this translation helpful? Give feedback.
-
Not sure about your current issue, but I am working through chapter 15 and found that some of the apollo code is out of date. Specifically the code referring to client.writeData become out of date with the new releases of Apollo. signup.js //Apollo Client //Mutation hook
}); App.js //configure Apollo Client const IS_LOGGED_IN = gql cache.writeQuery({ |
Beta Was this translation helpful? Give feedback.
-
I am working through the notedly website in the book. I am in chapter 15 "Web Authentication and State" having just completed the section "Creating a Sign-In Form". I am trying to run the application at this point. I have also tried running solution 04-Authentication-State.
I have no current user -> Authentication is not defined in the req headers. This causes a failure in the getUser function in api/source/index.js. Specifically, the call to jwt.verify returns "JsonWebTokenError: jwt malformed". This prevents me from running any action which calls getUser. It appears that the code always expect a Authorization to be a jwt function. But how can this be if there is no signed-in user?
What should getUser return if there is no user and whatt.verify would the modified code look like?
Note: I previously discovered that I had to call JSON.parse on the token to obtain an object which I could pass to jwt.verify. If authentication header is undefined, the call to JSON.parse returns "SyntaxError: Unexpected token u in JSON at position 0" which happens because it tried to parse "undefined".
Howard Weiss
Beta Was this translation helpful? Give feedback.
All reactions