Open smeijer opened 5 years ago
Have the same issue
The following patch fixes it:
diff --git a/src/Auth.js b/src/Auth.js
index ff3825e..0ee8c54 100644
--- a/src/Auth.js
+++ b/src/Auth.js
@@ -7,7 +7,7 @@ type LoginMethodResponse {
# Token of the connection
token: String!
# Expiration date for the token
- tokenExpires: Float!
+ tokenExpires: String!
# The logged in user
user: User
}
Seems to indicate that whatever Meteor is sending for tokenExpires to graphQL is a Date, and earlier it could parse it into a float, but not anymore. Guess graphql tightened it's parser.
A patch would be nice highly needed, but I guess it means that you lose earlier GraphQL versions?
I am not sure, I think earlier graphql packages will also parse it as a String when the type is changed here. Remember, meteor has not changed here.
How do you apply this patch in a production environment? Has anyone created a fork that we can use?
I have a fork. it's meant to work with cultofcoders:apollo, but might work other apollo environments.
meteor add ujwal:apollo-accounts
Managed to patch this as follows:
import { ApolloServer } from 'apollo-server-express';
import { loadSchema, getSchema } from 'graphql-loader';
import { makeExecutableSchema } from 'graphql-tools';
import { initAccounts } from 'meteor/nicolaslopezj:apollo-accounts';
initAccounts({
loginWithFacebook: false,
loginWithGoogle: false,
loginWithLinkedIn: false,
loginWithPassword: true,
});
// RE: https://github.com/orionsoft/meteor-apollo-accounts/issues/90
const schema = getSchema();
schema.typeDefs = schema.typeDefs.replace('tokenExpires: Float!', 'tokenExpires: String!');
/* ... */
EDIT:
looks like tokenExpires
returns "Invalid Date"
. probably need to look into the resolver on the server side
EDIT:
Here's an extended patch to make sure expiration date is transmitted and parsed properly. @nicolaslopezj i'll be willing to PR if you take this
// RE: https://github.com/orionsoft/meteor-apollo-accounts/issues/90
const schema = getSchema();
schema.typeDefs = schema.typeDefs.replace('tokenExpires: Float!', 'tokenExpires: String!');
_.extend(schema.resolvers.LoginMethodResponse, schema.resolvers.LoginMethodResponse, {
tokenExpires({ tokenExpires }) {
return tokenExpires.toString();
},
});
I've upgraded the apollo and graphql packages to it's latests versions; and thereby broke this package
login
method.Changed dependencies since it was working:
Meteor: