-
-
Notifications
You must be signed in to change notification settings - Fork 104
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
Can not SingUp if previous session is expired #9
Comments
Thanks for reporting! Do you have a suggestion how to fix it? :) |
@rwieruch Hi, I am not GraphQL expert, but I do have an idea. let me = {};
if (req.body.operationName !== 'signUp' && req.body.operationName !== 'signIn') {
me = await getMe(req);
} And those operations should be named on client: const SIGN_UP = gql`
mutation signUp( ... What do you think? |
I think we can fix this issue like this. const getMe = async req => {
const token = req.headers['x-token'];
if (token) {
try {
return await jwt.verify(token, process.env.SECRET);
} catch (e) {
// throw new AuthenticationError(
// 'Your session expired. Sign in again.',
// );
}
}
return null;
}; Why?* Many projects may have more public API. (as well as `signUp` and `signIn` ) |
syJSdev
added a commit
to syJSdev/fullstack-apollo-express-mongodb-boilerplate
that referenced
this issue
May 15, 2020
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If token is expired, there is no way to SignUp, as it tries to use current token.
See
getMe
method inindex.js
The text was updated successfully, but these errors were encountered: