Skip to content

Missing parameter: code error code response type. #533

@NicBonetto

Description

@NicBonetto

I've been trying to debug this and haven't had any luck. I am trying to authorize a token a client and send the authorization code, but the authorize method throws invalid_argument: Missing parameter: code. I traced it down to this function in code-response-types.js:

function CodeResponseType(code) {
  if (!code) {
    throw new InvalidArgumentError('Missing parameter: `code`');
  }

  this.code = code;
}

code is undefined in the above code snippet, and I think the reason for that is because code here:

.then(function(code) {
          var responseType = new ResponseType(code.authorizationCode);
          var redirectUri = this.buildSuccessRedirectUri(uri, responseType);

          this.updateResponse(response, redirectUri, state);

          return code;
        })

Looks like this:

constructor {
  attributes:
   { authorization_code: 'f4d5b9d07e6df6c2b2bddf284b34f33dced09116',
     expires_at: 2018-10-18T22:49:05.694Z,
     redirect_uri: 'http://0.0.0.0:3000/tokens',
     id: 8 },
  _previousAttributes:
   { authorization_code: 'f4d5b9d07e6df6c2b2bddf284b34f33dced09116',
     expires_at: 2018-10-18T22:49:05.694Z,
     redirect_uri: 'http://0.0.0.0:3000/tokens',
     id: 8 },
  changed: {},
  relations: {},
  cid: 'c7',
  _knex: null,
  id: 8 }

It is a response from a PostgreSQL query. If this is the issue, I don't know how to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions