Skip to content

Commit

Permalink
Updated documentation, fixed fields inclusion as user
Browse files Browse the repository at this point in the history
  • Loading branch information
theodorDiaconu committed Aug 29, 2018
1 parent 1c6279a commit ad36e38
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 18 deletions.
2 changes: 1 addition & 1 deletion client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ export function initialize(config = {}) {
};
}

export { Config };
export { Config, meteorAccountsLink };
14 changes: 2 additions & 12 deletions docs/accounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```
Expand All @@ -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 {
Expand All @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion docs/live_queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion package.js
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
8 changes: 5 additions & 3 deletions server/core/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
);

Expand Down

0 comments on commit ad36e38

Please sign in to comment.