Comments (2)
Ok my bad, the correct mutation to create a new user should be SignupUser
instead of CreateUser
, like this:
mutation {
signupUser(email: "[email protected]", password: "MySecretPassword") {
token
}
}
Then everything works fine.
Got it in the official forum here:
http://www.prisma.io/forum/t/template-auth-email-password-is-not-working/1805/3
from graphcool-templates.
Reproduced the same problem using Graphcool shared servers.
Here are the steps:
- Create a new project:
graphcool init
- Add email auth template:
graphcool-framework add-template auth/email-password
- Uncomment proper lines in
types.graphql
andgraphcool.yml
here is my final types.graphql
:
type User @model {
id: ID! @isUnique # read-only (managed by Graphcool)
createdAt: DateTime! # read-only (managed by Graphcool)
updatedAt: DateTime! # read-only (managed by Graphcool)
email: String! @isUnique
password: String!
}
here is my final graphcool.yml
types: ./types.graphql
functions:
signup:
type: resolver
schema: src/email-password/signup.graphql
handler:
code: src/email-password/signup.ts
authenticate:
type: resolver
schema: src/email-password/authenticate.graphql
handler:
code: src/email-password/authenticate.ts
loggedInUser:
type: resolver
schema: src/email-password/loggedInUser.graphql
handler:
code: src/email-password/loggedInUser.ts
hello:
handler:
code: src/hello.js
type: resolver
schema: src/hello.graphql
permissions:
- operation: "*"
- Deploy project to shared servers:
graphcool deploy
I deployed to eu-west1
-
Go to the graphiQL console provided by the deploy command
-
Create a new user:
mutation {
createUser (email: "[email protected]", password: "MySecretPassword") {
id
}
}
- Check the user is created:
query {
allUsers {
id
email
password
}
}
returns
{
"data": {
"allUsers": [
{
"id": "cjlr396u51c0l0138gllo608y",
"email": "[email protected]",
"password": "MySecretPassword"
}
]
}
}
This is already wrong: the value in the password field should be hashed and not displayed in clear. It should be a gibberish like: dufeiugug78TugDHSLIKgdsjgkguk or something like that.
- Authenticate user:
mutation {
authenticateUser (email: "[email protected]", password: "MySecretPassword") {
token
}
}
returns error:
{
"data": {
"authenticateUser": null
},
"errors": [
{
"locations": [
{
"line": 2,
"column": 3
}
],
"functionError": "Invalid credentials!",
"path": [
"authenticateUser"
],
"code": 5001,
"message": "function execution error: Invalid credentials!",
"requestId": "eu-west-1:simple:cjlr3apz512gc01392k8afi0n"
}
]
}
Did I miss something ?!
from graphcool-templates.
Related Issues (20)
- Facebook Delegated Account Recovery
- Google auth mutation is not working HOT 3
- Auth-templates for Linkedin and Twitter HOT 2
- Templates should be written in TypeScript HOT 4
- Create language branches so people can easily contribute in their own programming language
- Email-password authentication returning an unhandled error HOT 2
- Auth0 authentication broken on React Native HOT 2
- Email / Password template : Passwords revealed in function error logs HOT 2
- Utility functions in a template - Please vote HOT 3
- jwt.decode fails on new id_tokens
- Question: Can this be used via an SPA and without Auth0 Lock? HOT 4
- Authentication template for Gitlab users
- Slack Bot command handling support
- Auth template for Twitch
- Should I PR an updated SMS authentication with Twilio? HOT 1
- Can't distinguish expired tokens from empty responses
- Add template and GraphCool.yml no longer working
- Token produced no longer works with GraphCool
- OAuth 2.0 support for linkedin auth-template
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphcool-templates.