Coder Social home page Coder Social logo

meteor-apollo-accounts's Introduction

Meteor Apollo Accounts

A implementation of Meteor Accounts only in GraphQL with Apollo.

This package uses the Meteor Accounts methods in GraphQL, it's compatible with the accounts you have saved in your database and you may use apollo-accounts and Meteor's DPP accounts at the same time.

Project sponsored by Orion Hosting - Hosting for Meteor

Installing

Install on Meteor server

meteor add nicolaslopezj:apollo-accounts
yarn add graphql-loader

Initialize the package.

import {makeExecutableSchema} from 'graphql-tools'
import {loadSchema, getSchema} from 'graphql-loader'
import {initAccounts} from 'meteor/nicolaslopezj:apollo-accounts'
import typeDefs from './schema'
import resolvers from './resolvers'

// Load all accounts related resolvers and type definitions into graphql-loader
initAccounts({
  loginWithFacebook: false,
  loginWithGoogle: false,
  loginWithLinkedIn: false,
  loginWithPassword: true
})

// Load all your resolvers and type definitions into graphql-loader
loadSchema({typeDefs, resolvers})

// Gets all the resolvers and type definitions loaded in graphql-loader
const schema = getSchema()
const executableSchema = makeExecutableSchema(schema)

Install on your apollo app

May or may not be the same app.

npm install meteor-apollo-accounts

Examples

Tutorials

Methods

Meteor accounts methods, client side only. All methods are promises.

loginWithPassword

Log the user in with a password.

import { loginWithPassword } from 'meteor-apollo-accounts'

loginWithPassword({username, email, password}, apollo)
  • username: Optional. The user's username.

  • email: Optional. The user's email.

  • password: The user's password. The library will hash the string before it sends it to the server.

  • apollo: Apollo client instance.

changePassword

Change the current user's password. Must be logged in.

import { changePassword } from 'meteor-apollo-accounts'

changePassword({oldPassword, newPassword}, apollo)
  • oldPassword: The user's current password. This is not sent in plain text over the wire.

  • newPassword: A new password for the user. This is not sent in plain text over the wire.

  • apollo: Apollo client instance.

logout

Log the user out.

import { logout } from 'meteor-apollo-accounts'

logout(apollo)
  • apollo: Apollo client instance.

createUser

Create a new user.

import { createUser } from 'meteor-apollo-accounts'

createUser({username, email, password, profile}, apollo)
  • username: A unique name for this user.

  • email: The user's email address.

  • password: The user's password. This is not sent in plain text over the wire.

  • profile: The profile object based on the UserProfileInput input type.

  • apollo: Apollo client instance.

verifyEmail

Marks the user's email address as verified. Logs the user in afterwards.

import { verifyEmail } from 'meteor-apollo-accounts'

verifyEmail({token}, apollo)
  • token: The token retrieved from the verification URL.

  • apollo: Apollo client instance.

forgotPassword

Request a forgot password email.

import { forgotPassword } from 'meteor-apollo-accounts'

forgotPassword({email}, apollo)
  • email: The email address to send a password reset link.

  • apollo: Apollo client instance.

resetPassword

Reset the password for a user using a token received in email. Logs the user in afterwards.

import { resetPassword } from 'meteor-apollo-accounts'

resetPassword({newPassword, token}, apollo)
  • newPassword: A new password for the user. This is not sent in plain text over the wire.

  • token: The token retrieved from the reset password URL.

  • apollo: Apollo client instance.

loginWithFacebook

Logins the user with a facebook accessToken

import { loginWithFacebook } from 'meteor-apollo-accounts'

loginWithFacebook({accessToken}, apollo)

loginWithGoogle

Logins the user with a google accessToken

import { loginWithGoogle } from 'meteor-apollo-accounts'

loginWithGoogle({accessToken}, apollo)

onTokenChange

Register a function to be called when a user is logged in or out.

import { onTokenChange } from 'meteor-apollo-accounts'

onTokenChange(function () {
  console.log('token did change')
  apollo.resetStore()
})

userId

Returns the id of the logged in user.

import { userId } from 'meteor-apollo-accounts'

async function () {
  console.log('The user id is:', await userId())
}

React-Native usage

//First you'll need to import the Storage library that you'll use to store the user details (userId, tokens...),
// AsyncStorage is highly recommended.

import {
  ...
  AsyncStorage
} from 'react-native';

import { loginWithPassword, userId, setTokenStore} from 'meteor-apollo-accounts'

// Then you'll have to define a TokenStore for your user data using setTokenStore
// (for instance when your component is mounted):
setTokenStore({
  set: async function ({userId, token, tokenExpires}) {
    await AsyncStorage.setItem('Meteor.userId', userId)
    await AsyncStorage.setItem('Meteor.loginToken', token)
    // AsyncStorage doesn't support Date type so we'll store it as a String
    await AsyncStorage.setItem('Meteor.loginTokenExpires', tokenExpires.toString())
  },
  get: async function () {
    return {
      userId: await AsyncStorage.getItem('Meteor.userId'),
      token: await AsyncStorage.getItem('Meteor.loginToken'),
      tokenExpires: await AsyncStorage.getItem('Meteor.loginTokenExpires')
    }
  }
})

// Finally, you'll be able to use asynchronously any method from the library:
async login (event) {
  event.preventDefault();

  try {
    const id_ = await loginWithPassword({ "email", "password" }, this.client)
    this.client.resetStore()
  } catch (error) {

  }
}

Contributors

meteor-apollo-accounts's People

Contributors

dbrrt avatar herrkin avatar janikvonrotz avatar meta-dreamer avatar nicolaslopezj avatar zvictor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

meteor-apollo-accounts's Issues

Syntax for customizing the User schema with non-primitives?

I saw that we can customize the profile here:

//set options
const options = {
	CreateUserProfileInput: `
	    name: Name!
	  `
};

// Load all accounts related resolvers and type definitions into graphql-loader
initAccounts(options);

Is there any way to use objects? For instance if I need name to be an object like:

profile: {
 name: {
   first: String,
   last: String
  }
}

I have a user schema but just not sure the where/when/how to let meteor-apollo-accounts know about it:


export const UserSchema = [`

type Email {
  address: String
  verified: Boolean
}

type Name {
  first: String
  last: String
}

type Profile {
  name: Name
}

type User {
  emails: [Email]
  _id: String
  profile: Profile
  roles: [String]
}

type Query {
    user: User,
  }
`];

[loginWithFacebook]: Need better return value (was account created or not?)

After lots of testing, I have come to the conclusion that loginWithFacebook isn't exactly just "login with Facebook". It does two things:

  1. If you don't already have an account, it will CREATE an account for you and then sign you into it. So in a sense, this is actually signUpWithFacebook followed by loginWithFacebook.
  2. If you already have an account, then it will log you into it. This is where the loginWithFacebook name is appropriate.

In my app, I am trying to decide when the user goes through the loginWithFacebook process if they are:

A) creating a new account (aka signUpWithFacebook), or
B) logging in to an existing account (aka loginWithFacebook).

However, the method provided by this package does not give the necessary information to be able to figure this out on the client. All I get in response is the user's ID, but I don't know if the ID was just created or if the ID is an existing ID that was created previously.

My app needs to know this information so that it can send the user to the appropriate screen (i.e. sign them into the dashboard for loginWithFacebook versus walk them through the onboarding process for signUpWithFacebook).

Thoughts?

Meteor is not aware of the session changes

While trying to use loginWithPassword in a Meteor app, I realised that even though my user was logged in, Meteor was not aware of it (Meteor.userId() === null).

Checking the code I couldn't find any call to Accounts.makeClientLoggedIn, Accounts.connection.setUserId or similar. Shouldn't it be the case?

Include packages with import

I've seen that you are using global.* to include packages. Why not using import? This PR is not working, it's just an exmaple.

Example: import HTTP from 'meteor/http instead of var HTTP = global.HTTP

The advantage of this, is that Meteor knows what package is missing. I ran into many times while updating my example app.

I got messages like: 1114-12:33:06.212(1)? (STDERR) TypeError: Cannot read property 'secret' of undefined
1114-12:33:06.214(1)? (STDERR) at module.export.exports.default (packages/nicolaslopezj:apollo-accounts/src/Res
s/oauth/resolver.js:11:29)

And the solution was to add the missing package.

Create example app

Create a example app:

  • Meteor server side
  • Create react app client side

[Meteor 1.6] LoginMethodResponse tokenExpires returning invalid date

After upgrading to a recent Meteor 1.6 beta, I'm getting invalid date returned from LoginMethodResponse:

LoginMethodResponse
I20170726-11:57:14.883(-4)? { id: 'c54u8GPenebfvi873',
I20170726-11:57:14.883(-4)?   token: '_6I2TJCAUl6a7dFVvM3HnXAVczlqYMvDSkOj6W5nJr7',
I20170726-11:57:14.883(-4)?   tokenExpires: Invalid Date }

Relevant package.json:

    "graphql": "0.10.5",
    "graphql-date": "^1.0.3",
    "graphql-loader": "^1.2.1",
    "graphql-log": "^0.1.3",
    "graphql-redis-subscriptions": "^1.2.0",
    "graphql-server-express": "^1.0.4",
    "graphql-subscriptions": "^0.4.4",
    "graphql-tools": "^1.0.0",
    "graphql-type-json": "^0.1.4",

React Native empty context problem.

I'm working on react-native
loginWithPassword, logout both are working very well.

I'm trying to query logged in user data.

On server side, I just cloned your example.

What I want to do is to query me.

I have tried both graphiql and react-native.

It's working fine with graphiql, but not react-native.

In server, I did console.log(context);.
It is just empty object {}, when I execute this query from react-native.
However, with graphiql, context is like {userId: 'xxxx', user: {...}}.

What's the issue here?

Thanks in advance.

Ah, I properly setTokenStore in react-native like below.

import {
  AsyncStorage,
} from 'react-native';
import { setTokenStore } from 'meteor-apollo-accounts';

export default () => {
  setTokenStore({
    async set({ userId, token, tokenExpires }) {
      await AsyncStorage.setItem('Meteor.userId', userId);
      await AsyncStorage.setItem('Meteor.loginToken', token);
      await AsyncStorage.setItem('Meteor.loginTokenExpires', tokenExpires.toString());
    },

    async get() {
      return {
        userId: await AsyncStorage.getItem('Meteor.userId'),
        token: await AsyncStorage.getItem('Meteor.loginToken'),
        tokenExpires: await AsyncStorage.getItem('Meteor.loginTokenExpires'),
      };
    },
  });
};

createUser is not storing username

I am trying to sign up new users with createUser using email, password, profile, and username. I noticed that username field is not being stored in the Mongo documents, even though I can confirm on the front-end that username is indeed being sent as part of the object payload.

createUser({
  email: '[email protected]',
  password: 'some password',
  profile: {
    name: 'Test User',
  },
  username: 'testusername',
}, apollo);
{
    "_id" : "xyTByAWkFj7Z3NrGs",
    "createdAt" : ISODate("2017-05-22T16:23:08.279Z"),
    "services" : {
        "password" : {
            "bcrypt" : "$2a$10$rfZeR/08fNZIQBddFbSCfuYIH7pc2ghbA2g0/3OKSiYq5sF7IqKsa"
        },
        "resume" : {
            "loginTokens" : [ 
                {
                    "when" : ISODate("2017-05-22T16:23:08.289Z"),
                    "hashedToken" : "kL5AHPwpSNIc4xFLQF3R+jUK7JpBKk4j46BDX76Nugw="
                }
            ]
        }
    },
    "emails" : [ 
        {
            "address" : "[email protected]",
            "verified" : false
        }
    ],
    "profile" : {
        "name" : "Test User"
    }
}

[changePassword]: Cannot change password multiple times

When I use changePassword the first time, it works.

If I go immediately back to the form and do a changePassword again, it says "Must be logged in". If I do a console.log(await userId()), it still shows the user's ID.

Why does this fail on the second time?

Error: Type "User" not found in document.

I get an Error: Type "User" not found in document. when trying to set up apollo-accounts as described in the README. Here is my code:

import { createApolloServer } from 'meteor/apollo';
import { initAccounts } from 'meteor/nicolaslopezj:apollo-accounts';
import {
  makeExecutableSchema,
  addMockFunctionsToSchema,
} from 'graphql-tools';
import {
  loadSchema,
  getSchema,
} from 'graphql-loader';
import { typeDefs } from './schema';
import { resolvers } from './resolvers';

// Init Meteor apollo accounts
const options = {};
initAccounts(options);

// Load all resolvers and type definitions into graphql-loader
loadSchema({typeDefs, resolvers});

// Get all resolvers and type definitions loaded in graphql-loader
const schema = makeExecutableSchema(getSchema());

createApolloServer({
  schema,
});

What am I doing wrong? Do I have to put a User type into my own schema? Because the README suggests, that this gets added with this line:

// Load all accounts related resolvers and type definitions into graphql-loader
initAccounts(options)

Thanks for your help!

Resolvers is not a fonction

After updating the package to the latest version and updating all the spread operators to fonctions the project couldnt work. Im having an error in the chrome console telling me that "resolvers" is not à fonction.

Is there anything else to do to upgrade from the previous version of the package ?

Network error: regeneratorRuntime is not defined

I've been using this library with great success on React Native, but when I try calling any of the mutations from a Meteor web app, I'm getting:

screen shot 2017-06-05 at 12 30 58 am

Any ideas on what I'm doing wrong? I've tried adding

import "regenerator-runtime/runtime";

to both client and server code, but the result is the same.

How to define custom field in user.profile schema?

Hi,

I am trying to create a custom user profile object through the createUser mutation.

createUser({
          email,
          password,
          profile: {
            gender: 'male',
            name,
          },
          username,
        }, apollo);

However I keep getting the error:

GraphQL error: Variable "$profile" got invalid value {"gender":"male","name":"Some Name"}.
In field "gender": Unknown field.

How do I register gender as a known field under profile? After digging around, I saw a lot of references to CreateUserProfileInput. Do I need to extend this in some way?

wrong package name in error-message

When checking the versions of the NPM dependencies, this packages specifies a fake name, which will then show up the error messages on the console, making it hard to understand what's going on.

(It should say nicolaslopezj:apollo-accounts, instead of orionsoft:stripe-graphql.)

Storing profile data in Apollo store once user is logged?

I don't really know if that's feasible (since I don't really understand how "id" has been set on server) :
I'd like to store profile data in the Apollo Store, once the user has been successfully logged.
The LoginResponse schema fetch id, token and tokenExpires but it'd be also interesting in some cases to have profile data reachable, so is that possible to add as an extra parameter in LoginResponse schema, user profile as profile: UserProfile, and storing it as an Object in "global.localStorage['Meteor.profile']" for instance?
Then it would be really easy to grab anything like username, firstname, lastname and other things corresponding to the Meteor user.
In other hand, that could cause side effects with Oauth services... So I don't know if that's a good idea to implement something like that. Or simply, once the user is logged, getting profile data in a callback function?

Getting odd "unhandled promise rejection" errors with react-native on android.

The same code seems to work fine when I run the app on an iphone 7, but getting errors on my galaxy s6. I thought maybe I needed to add .done() to the promise after reading this:

facebook/react-native#6925

but .done() is undefined.

I'm not really sure what is going on. Everything works on iOS. My own mutations/queries are all working on android and talking to the server other than the meteor-apollo-accounts. I'm wondering if maybe it has something to do with the Async storage setup? I'm confused because I have a catch in place.

Write Tests

Since there are multiple contributors now, I think it's necessary to have good test coverage moving forward, especially the client side. Apollo's mocking tools should help a lot with this.

[React Native]: Usage with Redux / Redux Persist

I store most of my app's internal state in Redux. Doing so allows components to communicate with one another via state variables, and it standardizes the process under one single API to get and set those state variables.

I'd really like to store the user's ID and other tokens in Redux as well, and access them synchronously via connecting my components:

const mapStateToProps = (state) => ({
  userState: state.userState,
});

...

connect(mapStateToProps);

...

const normalFunction = () => {
  ...
  const userId = userState._id;
  const userToken = userState.token;
  const userTokenExpires = userState.tokenExpires;
  ...
};

When the app boots up, the tokens could be rehydrated to the store using redux-persist.

    persistStore(
      store, {
        storage: AsyncStorage,
        whitelist: [
          ...
          'userState',
          ...
        ],
      },
    );

Right now, it looks like I have to store the user tokens directly in AsyncStorage in order for this package to work properly (specifically using setTokenStore), rather than being able to store it in Redux, and use redux-persist to handle the rehydration of tokens from the store.

Accounts.destroyToken in logout.js doesn't work

Hi,

I figured out that Accounts.destroyToken in your logout function won't destroy the token, as the method expects a hashed token hashed with Accounts._hashLoginToken(token).

I tried it this way and it works - it removes the token but it throws an exception afterwards:

 Exception in queued task: TypeError: connection.close is not a function
     at removed (packages/accounts-base/accounts_server.js:929:22)
     at packages/mongo/observe_multiplex.js:183:30
     at Array.forEach (native)
     at Function._.each._.forEach (packages/underscore.js:139:11)
     at Object.task (packages/mongo/observe_multiplex.js:177:9)
     at [object Object]._.extend._run (packages/meteor.js:807:18)
     at packages/meteor.js:785:14

I haven't found a solution yet, but wanted to inform you.

Naming libs

Not really a functionnal issue, but I think that the package/lib naming is a bit confusing :

  • meteor-apollo-accounts could be replaced with something like apollo-accounts-client, since it's working on potentially any front-end client with React and Apollo running, (including React-native)
  • apollo-accounts could be replaced with something like apollo-accounts-server

GraphQL error: Schema is not configured for mutations

Hello,
when I loginWithPassword({ email, password }, apolloClient) it returns the error GraphQL error: Schema is not configured for mutations. Yet I've ofc did initAccounts(); then loaded with loadSchema the schema and the resolvers, that you can see here :

// schema
[`
  type User {
    _id: Int
    name: String
    emails: [Email]
    password: String
    admin: Boolean
  }
  
  type Email {
    address: String
    verified: Boolean
  }
`];
// resolvers 
{
  Query: {
    users(_, args) {
      return User.findAll({ where: args });
    },
  },
};

Your package seems good but is very widely undocumented unfortunately.
And obviously after all that I've makeExecutableSchema and created the apollo server with the function createApolloServer.

Documentation needed

I intend to use this package, because the Meteor/Apollo documentation suggested so:

If you want to use only GraphQL in your app you can use nicolaslopezj:apollo-accounts. This package uses the Meteor Accounts methods in GraphQL, it’s compatible with the accounts you have saved in your database and you may use nicolaslopezj:apollo-accounts and Meteor’s DDP accounts at the same time.

So, my goal is to use this package as a backend for the account system, replacing the default MongoDB-based one. (I don't use MongoDB in our project at all; it's all based on PG.)

Is it feasible to use this package like that?
If yes, then some more documentation would be useful.

LoginMethodResponse type is missing

Hi, I just wanted to setup an example application for you. https://github.com/janikvonrotz/meteor-apollo-accounts-example
But then I got this message:

Error: Type "LoginMethodResponse" not found in document.
W20161018-21:27:24.729(-7)? (STDERR)     at typeDefNamed (C:\Users\janikvonrotz\Documents\GitHub\meteor-apollo-accounts-example\node_modules\graphql\utilities\buildASTSchema.js:

I assume this is one of the response types you are using in your meteor accounts schema. Could you update the meteor package?

Using meteor-apollo-accounts to secure pages

Hi was just wondering how to use this package to secure components views ?
For example, a logged user will have access to a page and not another one if not logged.
Should we use something like the "me" variable in the ApolloClient, fetching data from gql server and checking it before mounting the Component View or there's something more elegant?

React UI Components

This is a pretty awesome project for people using Meteor+Apollo, but what about the UI layer? Can this work with something like accounts-ui? Or do you just roll out your own components?

initAccounts is not a function

Hello,

I'm trying to use meteor-apollo-accounts, with the tutorial http://dev.apollodata.com/core/meteor.html and your README.md.

So now I have :

import { createApolloServer } from 'meteor/apollo';
import { makeExecutableSchema, addMockFunctionsToSchema } from 'graphql-tools';
import {initAccounts} from 'meteor/nicolaslopezj:apollo-accounts'
import {loadSchema, getSchema} from 'graphql-loader'

import { typeDefs } from '/imports/api/schema';
import { resolvers } from '/imports/api/resolvers';

const options = {}
// Load all accounts related resolvers and type definitions into graphql-loader
initAccounts(options)

// Load all your resolvers and type definitions into graphql-loader
loadSchema({typeDefs, resolvers})

// Gets all the resolvers and type definitions loaded in graphql-loader
const schema = getSchema()
const executableSchema = makeExecutableSchema(schema)

createApolloServer({
	 executableSchema,
});

when I launch the application, my server crash :

W20170202-17:22:45.325(-5)? (STDERR) Note: you are using a pure-JavaScript implementation of bcrypt.
W20170202-17:22:45.325(-5)? (STDERR) While this implementation will work correctly, it is known to be
W20170202-17:22:45.326(-5)? (STDERR) approximately three times slower than the native implementation.
W20170202-17:22:45.326(-5)? (STDERR) In order to use the native implementation instead, run
W20170202-17:22:45.326(-5)? (STDERR)
W20170202-17:22:45.327(-5)? (STDERR)   meteor npm install --save bcrypt
W20170202-17:22:45.327(-5)? (STDERR)
W20170202-17:22:45.327(-5)? (STDERR) in the root directory of your application.
W20170202-17:22:45.348(-5)? (STDERR) WARNING: npm peer requirements (for apollo) not installed:
W20170202-17:22:45.348(-5)? (STDERR)  - [email protected] installed, graphql-server-express@^0.4.3 needed
W20170202-17:22:45.349(-5)? (STDERR)  - [email protected] installed, graphql@^0.7.0 || ^0.8.0 needed
W20170202-17:22:45.349(-5)? (STDERR)  - [email protected] installed, graphql-tools@^0.8.0 needed
W20170202-17:22:45.349(-5)? (STDERR)
W20170202-17:22:45.350(-5)? (STDERR) Read more about installing npm peer dependencies:
W20170202-17:22:45.350(-5)? (STDERR)   http://guide.meteor.com/using-packages.html#peer-npm-dependencies
W20170202-17:22:45.350(-5)? (STDERR)
W20170202-17:22:45.639(-5)? (STDERR) C:\Users\Erwan\AppData\Local\.meteor\packages\meteor-tool\1.4.2_3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:280
W20170202-17:22:45.639(-5)? (STDERR)                                            throw(ex);
W20170202-17:22:45.639(-5)? (STDERR)                                            ^
W20170202-17:22:45.640(-5)? (STDERR)
W20170202-17:22:45.640(-5)? (STDERR) TypeError: initAccounts is not a function
W20170202-17:22:45.641(-5)? (STDERR)     at server/main.js:19:2
W20170202-17:22:45.641(-5)? (STDERR)     at Function.time (C:\Users\Erwan\Documents\Perso\Travaux\looc\api-server\.meteor\local\build\programs\server\profile.js:301:28)
W20170202-17:22:45.641(-5)? (STDERR)     at C:\Users\Erwan\Documents\Perso\Travaux\looc\api-server\.meteor\local\build\programs\server\boot.js:304:13
W20170202-17:22:45.642(-5)? (STDERR)     at C:\Users\Erwan\Documents\Perso\Travaux\looc\api-server\.meteor\local\build\programs\server\boot.js:345:5
W20170202-17:22:45.642(-5)? (STDERR)     at Function.run (C:\Users\Erwan\Documents\Perso\Travaux\looc\api-server\.meteor\local\build\programs\server\profile.js:480:12)
W20170202-17:22:45.642(-5)? (STDERR)     at C:\Users\Erwan\Documents\Perso\Travaux\looc\api-server\.meteor\local\build\programs\server\boot.js:343:11
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.

I really don't understand. Is the tutorial up-to-date ?

thanks in advance, and good job 👍 I really need it ^^

Error on mutation / loginWithPassword

Hello,
I got this error using loginWithPassword with the last version of this package

Error: Network error: JSON.parse: unexpected character at line 1 column 1 of the JSON data Stacktrace : ApolloError@http://localhost:3000/packages/modules.js?hash=ef09dcb3c23d04ed293f67d0e02e2fade2789941:33962:23 require<.node_modules["apollo-client"].core["QueryManager.js"]</QueryManager</QueryManager.prototype.mutate/</<@http://localhost:3000/packages/modules.js?hash=ef09dcb3c23d04ed293f67d0e02e2fade2789941:33338:24 Meteor.bindEnvironment/<@http://localhost:3000/packages/meteor.js?hash=e3f53db3be730057fed1a5f709ecd5fc7cae1229:1105:17

Anyone has been able to use it ?

Note that this doesn't work neither with React-Native (in my configuration)

Why are not all mutations included?

Hi, I just added this package into my Meteor App and I can see the basic Mutation added
screen shot 2017-04-12 at 5 03 13 pm

However, I don't see the mutations of loginwithFacebook added? I know there is a check "hasService" which looks are the packages to see if accounts-facebook is present, but is this required? The reason why I am asking is because while using Meteor 1.4.4 together with meteor-apollo-accounts and accounts-facebook package, I am getting the following error:

Error: Already registered the facebook OAuth service
W20170412-16:56:55.966(8)? (STDERR) at Object.OAuth.registerService (packages/oauth.js:65:11)
W20170412-16:56:55.966(8)? (STDERR) at packages/facebook-oauth.js:49:7
W20170412-16:56:55.967(8)? (STDERR) at packages/facebook-oauth.js:125:4
W20170412-16:56:55.967(8)? (STDERR) at packages/facebook-oauth.js:137:3
W20170412-16:56:55.967(8)? (STDERR) at /Users/juniobranco/IdeaProjects/sorteios_mreact/.meteor/local/build/programs/server/boot.js:303:34
W20170412-16:56:55.968(8)? (STDERR) at Array.forEach (native)
W20170412-16:56:55.968(8)? (STDERR) at Function..each..forEach (/Users/juniobranco/.meteor/packages/meteor-tool/.1.4.4_1.1re4zut++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
W20170412-16:56:55.968(8)? (STDERR) at /Users/juniobranco/IdeaProjects/sorteios_mreact/.meteor/local/build/programs/server/boot.js:128:5
W20170412-16:56:55.969(8)? (STDERR) at /Users/juniobranco/IdeaProjects/sorteios_mreact/.meteor/local/build/programs/server/boot.js:352:5
W20170412-16:56:55.969(8)? (STDERR) at Function.run (/Users/juniobranco/IdeaProjects/sorteios_mreact/.meteor/local/build/programs/server/profile.js:510:12)

Add user field to LoginMethodResponse

We want:

# Type returned when the user logs in
type LoginMethodResponse {
  # Id of the user logged in user
  id: String!
  # Token of the connection
  token: String!
  # Expiration date for the token
  tokenExpires: Float!
  # Logged in user
  user: User!
}

But we would need to define the type User... Maybe pass the type name as an option?

How to detect current user synchronously?

In my render function, I want to render a View depending on whether or not the user is signed in or not. You can do this synchronously via:

{currentUser &&
  <View>
    {...}
  </View>
}

How do you achieve this with meteor-apollo-accounts? The only thing I can find is userId, but that is an async value so it doesn't work in the above example. Thanks!

[createUser Mutation]: Allow custom fields on user document (not .profile)?

Right now the createUser mutation only provides a profile argument where you can supply additional user info such as name, birthday, gender, etc. to store on the profile field in the user document.

However, Meteor doesn't recommend storing ANY of your user data on profile and instead recommends storing it as a first-class field on the user document.

It would be great if createUser were expanded to allow custom fields like this, so we're not forced to stick things under profile, especially when MDG doesn't recommend it.

Customize Error Messages

Would be great if there were a hook in this library to customize the errors that come back from the graph QL server. Such as using https://github.com/thebigredgeek/apollo-errors

For example, if the error is user is not found, the error is:

GraphQL error: User not found [403]

But I would like it to say

No account for user <user>. Did you mean to sign up instead?

addEmail and removeEmail Mutations

My user account system relies on the fact that users can have more than one email address. I noticed that this package is missing support for some of the core Meteor APIs:

Are these on the roadmap to be added?

Remove browser reload

Hey there, can you remove the browser reload from the npm package as discussed in #3 and maybe close #1 ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.