Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing access_tokens endpoint #305

Open
troyconquer opened this issue Oct 29, 2016 · 2 comments
Open

Testing access_tokens endpoint #305

troyconquer opened this issue Oct 29, 2016 · 2 comments

Comments

@troyconquer
Copy link

Hi there,

I'm having an issue getting my integration test to run - and I may be doing something wrong. I noticed #300 could be related.

Try to run:

...
    it('Should return an HTTP 200', done => {
      let body = {
        "grant_type": "password",
        "username": "test@emails.com",
        "password": "password"
      }

      this.endpoint("/v1/access_tokens").post(body, (status, headers, body, json) => {

        //returns 400
        expect(status).to.equal(200);
        done();

      });

    });
...

access_token.js

...
  static login(params, callback) {

    //grant_type is not set..
    if (params.body.grant_type !== 'password') {
      return callback(new Error('Must supply grant_type'));
    }

    User.query()
      .where({username: params.body.username})
...

Hope I'm missing something silly. Halp?

Thanks,

Troy

@keithwhor
Copy link
Owner

Aha. These could be related. It'll take a few days for me to dig into this and #300, but will let you know when I do.

@eperiou
Copy link

eperiou commented Apr 10, 2017

Is this user in the database already?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants