All Projects β†’ orionsoft β†’ Meteor Apollo Accounts

orionsoft / Meteor Apollo Accounts

Licence: mit
Meteor accounts in GraphQL

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Meteor Apollo Accounts

Pup
The Ultimate Boilerplate for Products.
Stars: ✭ 563 (+288.28%)
Mutual labels:  graphql, apollo, meteor
Meteor Integration
πŸš€ meteor add apollo
Stars: ✭ 107 (-26.21%)
Mutual labels:  graphql, apollo, meteor
Next Apollo Auth
Authentication Boilerplate with Next.js and Apollo GraphQL
Stars: ✭ 159 (+9.66%)
Mutual labels:  graphql, apollo, authentication
Pizzaql
πŸ• Modern OSS Order Management System for Pizza Restaurants
Stars: ✭ 631 (+335.17%)
Mutual labels:  graphql, apollo, authentication
Blaze Apollo
Blaze integration for the Apollo Client
Stars: ✭ 56 (-61.38%)
Mutual labels:  graphql, apollo, meteor
Meteor Apollo Starter Kit
Meteor, Apollo, React, PWA, Styled-Components boilerplate
Stars: ✭ 91 (-37.24%)
Mutual labels:  graphql, apollo, meteor
Apollo
Meteor & Apollo integration
Stars: ✭ 87 (-40%)
Mutual labels:  graphql, apollo, meteor
Next Advanced Apollo Starter
Advanced, but minimalistic Next.js pre-configured starter with focus on DX
Stars: ✭ 131 (-9.66%)
Mutual labels:  graphql, apollo, authentication
Nextjs Headless Wordpress
πŸ”₯ Nextjs Headless WordPress
Stars: ✭ 110 (-24.14%)
Mutual labels:  graphql, authentication
Livepeerjs
JavaScript tools and applications that interact with Livepeer's smart contracts and peer-to-peer network
Stars: ✭ 116 (-20%)
Mutual labels:  graphql, apollo
Graphql Directive
Use custom directives in your GraphQL schema and queries 🎩
Stars: ✭ 142 (-2.07%)
Mutual labels:  graphql, apollo
Create Apollo App
Create Apollo App is a command-line tool designed to generate fully-configured starter Apollo GraphQL projects with essential dependencies for developing web, server and mobile applications and zero build configuration.
Stars: ✭ 110 (-24.14%)
Mutual labels:  graphql, apollo
Apollo Link
πŸ”— Interface for fetching and modifying control flow of GraphQL requests
Stars: ✭ 1,434 (+888.97%)
Mutual labels:  graphql, apollo
Nest User Auth
A starter build for a back end which implements managing users with MongoDB, Mongoose, NestJS, Passport-JWT, and GraphQL.
Stars: ✭ 145 (+0%)
Mutual labels:  graphql, authentication
Thorium
Platform for starship simulator controls
Stars: ✭ 109 (-24.83%)
Mutual labels:  graphql, apollo
Graphql Directive Auth
GraphQL directive for handling auth
Stars: ✭ 120 (-17.24%)
Mutual labels:  graphql, authentication
React Graphql Github Apollo
πŸš€ A React + Apollo + GraphQL GitHub Client. Your opportunity to learn about these technologies in a real world application.
Stars: ✭ 1,563 (+977.93%)
Mutual labels:  graphql, apollo
Universal React Apollo Example
Universal React Apollo App (GraphQL) consuming: https://github.com/WeLikeGraphQL/wordpress-graphql-api-example!
Stars: ✭ 117 (-19.31%)
Mutual labels:  graphql, apollo
Goofi
✨Let's contribute to OSS. Here is how to find good first issues in GitHub. "goofi" is an abbreviation of "good first issues".
Stars: ✭ 125 (-13.79%)
Mutual labels:  graphql, apollo
Apollo Universal Starter Kit
Apollo Universal Starter Kit is an SEO-friendly, fully-configured, modular starter application that helps developers to streamline web, server, and mobile development with cutting-edge technologies and ultimate code reuse.
Stars: ✭ 1,645 (+1034.48%)
Mutual labels:  graphql, apollo

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].