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

Suggested update for README #303

Closed
ioMatrix opened this issue Feb 2, 2020 · 1 comment
Closed

Suggested update for README #303

ioMatrix opened this issue Feb 2, 2020 · 1 comment

Comments

@ioMatrix
Copy link
Contributor

ioMatrix commented Feb 2, 2020

There is little documentation for the options available for tokenHost/tokenPath.

I was getting an error: "Access Token error The content-type is not JSON compatible" because I was entering the full path for a client_credentials token request.

It is required that the credentials.tokenPath be overridden or the default (and incorrect) path is used. This is not documented anywhere I could see. Had to parse the code to figure it out.

const credentials = {
  client: {
    id: 'xxxxx',
    secret: 'xxxxxxx'
  },
  auth: {
    tokenHost: 'https://auth.eadash.com',
    tokenPath: 'oauth2/default/v1/token',
  }
};

Hope this helps any other poor souls pulling their hair trying to figure it out. Perhaps the examples in the documentation could show this?

Here is a snippet of the index which show other defaults...

const optionsSchema = Joi
  .object()
  .keys({
    client: Joi.object().keys({
      id: Joi.string().pattern(vsCharRegEx).allow(''),
      secret: Joi.string().pattern(vsCharRegEx).allow(''),
      secretParamName: Joi.string().default('client_secret'),
      idParamName: Joi.string().default('client_id'),
    }).required(),
    auth: Joi.object().keys({
      tokenHost: Joi.string().required().uri({ scheme: ['http', 'https'] }),
      tokenPath: Joi.string().default('/oauth/token'),
      revokePath: Joi.string().default('/oauth/revoke'),
      authorizeHost: Joi.string().uri({ scheme: ['http', 'https'] }).default(Joi.ref('tokenHost')),
      authorizePath: Joi.string().default('/oauth/authorize'),
    }).required(),
    http: Joi.object().unknown(true),
    options: Joi.object().keys({
      scopeSeparator: Joi.string().default(' '),
      credentialsEncodingMode: Joi.string().valid('strict', 'loose').default('strict'),
      bodyFormat: Joi.string().valid('form', 'json').default('form'),
      authorizationMethod: Joi.any().valid('header', 'body').default('header'),
    }).default(),
  });

Pull request sent.

@jonathansamines
Copy link
Collaborator

Resolved by #304

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

2 participants