freeCodeCamp / open-api

freeCodeCamp's open-api Intiative
BSD 3-Clause "New" or "Revised" License
89 stars 28 forks source link

Can't createUser with the header generated by `yarn generate-auth-header` #152

Closed user512 closed 6 years ago

user512 commented 6 years ago

Describe the bug

Initial setup cannot run all test cases in development email was missing in generate-auth-header to prevent first time developer to run createUser

To Reproduce

  1. Run yarn generate-auth-header
  2. Create user using the below script
    mutation createUser {
    createUser {
    email
    name
    }
    }
  3. Error returns
    {
    "data": {
    "createUser": null
    },
    "errors": [
    {
      "message": "This library (validator.js) validates strings only",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "createUser"
      ]
    }
    ]
    }

Expected behavior

By using generate-auth-header, developer should be able to createUser Suggestion, add an email placeholder in https://github.com/freeCodeCamp/open-api/blob/40de4e31d1121dfa70519e91a495ccefc0613582/scripts/generateHeader.js#L6

user512 commented 6 years ago

I am not quite sure if the current setup is intentional but I know added email in generateHeader will resolve this problem for me, happy to submit a PR if the above direction is correct.

ojongerius commented 6 years ago

Hi @user512 yup! Would be great if you could raise a PR for that.

Ideal would be:

user512 commented 6 years ago

👍 will open a PR today to patch genereteHeader and add test.

ojongerius commented 6 years ago

Great, thank you!

user512 commented 6 years ago

154 patched genereteHeader.js and added test in userFlow.test.js