diff --git a/client/index.js b/client/index.js index 6fd5ee6..c8445c3 100644 --- a/client/index.js +++ b/client/index.js @@ -83,4 +83,4 @@ export function initialize(config = {}) { }; } -export { Config }; +export { Config, meteorAccountsLink }; diff --git a/docs/accounts.md b/docs/accounts.md index f72418b..c0a6f1d 100644 --- a/docs/accounts.md +++ b/docs/accounts.md @@ -30,8 +30,6 @@ initialize({}, { }), ``` -`userId` works with your client and with `/graphiql` because the `Meteor.loginToken` is stored in `localStorage` and it's on the same domain, making very easy for you to test your queries and mutations. - Adding accounts to your GraphQL Schema: ``` @@ -58,9 +56,7 @@ const AccountsModule = initAccounts({ load(AccountsModule); // Make sure you have User type defined as it works directly with it ``` -Now you can already start creating users, logging in, open up your GraphiQL and look in the Mutation documentations. - -If you want to test authentication live and you don't yet have a client-side setup. Just create a user: +You can register an account like this: ```js mutation { @@ -73,13 +69,7 @@ mutation { } ``` -Store it in localStorage, in your browser console: - -```js -localStorage.setItem('Meteor.loginToken', token); // the one you received from the query result -``` - -Create a quick `me` query: +Test the fact that you can query the logged in user: ```js import { load } from 'meteor/cultofcoders:apollo'; diff --git a/docs/live_queries.md b/docs/live_queries.md index 51c0524..805436a 100644 --- a/docs/live_queries.md +++ b/docs/live_queries.md @@ -60,7 +60,7 @@ Meteor.setInterval(function() { }, 2000); ``` -You can now test your query inside GraphiQL, to see how easily it reacts to changes: +You can now test your query inside GraphQL Playground, to see how easily it reacts to changes: ```js subscription { diff --git a/package.js b/package.js index 4270466..7bfbfef 100644 --- a/package.js +++ b/package.js @@ -1,6 +1,6 @@ Package.describe({ name: 'cultofcoders:apollo', - version: '0.7.4', + version: '0.7.5', // Brief, one-line summary of the package. summary: 'Meteor & Apollo integration', // URL to the Git repository containing the source code for this package. diff --git a/server/core/users.js b/server/core/users.js index 13faf9f..5aac7cd 100644 --- a/server/core/users.js +++ b/server/core/users.js @@ -21,13 +21,15 @@ export const getUserForContext = async (loginToken, userDefaultFields) => { // get the possible current user from the database // note: no need of a fiber aware findOne + a fiber aware call break tests // runned with practicalmeteor:mocha if eslint is enabled - const currentUser = await Meteor.users.rawCollection().findOne( + const currentUser = Meteor.users.findOne( { 'services.resume.loginTokens.hashedToken': hashedToken, }, { - ...userDefaultFields, - 'services.resume.loginTokens': 1, + fields: { + ...userDefaultFields, + 'services.resume.loginTokens': 1, + }, } );