panva / openid-client

OAuth 2 / OpenID Connect Client API for JavaScript Runtimes
MIT License
1.83k stars 392 forks source link

Minor not exact types #331

Closed dnikomon closed 3 years ago

dnikomon commented 3 years ago

Describe the bug

export interface StrategyOptions<TClient extends Client> {
  client: TClient;
  /**
   * Authorization Request parameters. The strategy will use these.
   */
  params?: AuthorizationParameters;

  /**
   * "extras" argument value passed to the client.callback() call.
   */
  extras?: CallbackExtras;
  /**
   * Boolean specifying whether the verify function should get the request object as first argument instead.
   * Default: 'false'
   */
  passReqToCallback?: boolean;
  /**
   * The PKCE method to use. When 'true' it will resolve based on the issuer metadata, when 'false' no PKCE will be
   * used. Default: 'false'
   */
  usePKCE?: boolean | string;
  /**
   * The PKCE method to use. When 'true' it will resolve based on the issuer metadata, when 'false' no PKCE will be
   * used. Default: 'false'
   */
  sessionKey?: string;
}

usePKCE & sessionKey have same annotation

function OpenIDConnectStrategy({ client, params = {}, passReqToCallback = false, sessionKey, usePKCE = true, extras = {}, }

Also usePKCE default is true in code and false in documentation

export type StrategyVerifyCallbackReq<TUser> = (req: http.IncomingMessage, tokenset: TokenSet, done: (err: any, user?: TUser) => void) => void;

Also I don't know if it's me only but in my environment req is more like Express.Request and not at all like http.IncomingMessage

Environment:

panva commented 3 years ago

Also I don't know if it's me only but in my environment req is more like Express.Request and not at all like http.IncomingMessage

express.Request extends http.IncomingMessage

dnikomon commented 3 years ago

I'm an idiot so I don't understand how this explains my problem. I need to access session in callback so I have to do casting like const customReq = (req as unknown) as Request to access it.