React-starter-kit: Create login(), logout() GraphQL mutations

Created on 27 Feb 2016  路  5Comments  路  Source: kriasoft/react-starter-kit

src/data/mutations/user.login.js
src/data/mutations/user.logout.js

Login mutations validates user's email and password via passport.validate('basic') or passport.validate('local'), creates id_token JWT token, sends it via HttpOnly cookie and refreshes me query. Logout mutation removes id_token cookie and refreshes the me query.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

enhancement help wanted ready

Most helpful comment

+1 for react-relay implementation with GraphQL mutations

All 5 comments

:-1: Http-api easier to use for simple apps.
Include react-relay and GraphQL server in "starter kit"?

+1 for react-relay implementation with GraphQL mutations

@Bogdaan if you already use GraphQL for data, why to use another approach for login/logout?

@koistya GraphQL/react-relay is great, and you code is awesome. Perhaps graph query/mutation is the "right way".
But there are cases where REST api is preferred:

  • mobile-app / native-app clients
  • no-backend app ( web-client <--> RSK <--> Scala/Python/C++/hhvm backend )

how we can login-local via passportjs? and check user login and logout?

Was this page helpful?
0 / 5 - 0 ratings