### Hierarchy

- Stream
  - XOAuth2

## Index

### Interfaces

- Options
- RequestParams
- Token

### Constructors

- constructor

### Properties

- accessToken
- expires
- logger
- options
- defaultMaxListeners

### Methods

- addListener
- buildXOAuth2Token
- emit
- eventNames
- generateToken
- getMaxListeners
- getToken
- jwtSignRS256
- listenerCount
- listeners
- off
- on
- once
- pipe
- postRequest
- prependListener
- prependOnceListener
- rawListeners
- removeAllListeners
- removeListener
- setMaxListeners
- toBase64URL
- updateToken
- listenerCount

## Constructors

### constructor

- new XOAuth2(options: Options, logger: Logger): XOAuth2

- - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:50

  #### Parameters

  - ##### options: Options

  - ##### logger: Logger

  #### Returns XOAuth2

## Properties

### accessToken

accessToken: string | false

- Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:49

### expires

expires: number

- Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:50

### logger

logger: Logger

- Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:48

### options

options: Options

- Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:47

### Static defaultMaxListeners

defaultMaxListeners: number

Inherited from EventEmitter.defaultMaxListeners

- Defined in node_modules/@types/node/events.d.ts:8

## Methods

### addListener

- addListener(event: "error", listener: function): this
- addListener(event: "token", listener: function): this

- Overrides EventEmitter.addListener

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:82

  #### Parameters

  - ##### event: "error"

  - ##### listener: function

    - - (err: Error): void

      - #### Parameters

        - ##### err: Error

        #### Returns void

  #### Returns this

- Overrides EventEmitter.addListener

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:83

  #### Parameters

  - ##### event: "token"

  - ##### listener: function

    - - (token: Token): void

      - #### Parameters

        - ##### token: Token

        #### Returns void

  #### Returns this

### buildXOAuth2Token

- buildXOAuth2Token(accessToken: string): string

- - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:64

  Converts an access_token and user id into a base64 encoded XOAuth2 token

  #### Parameters

  - ##### accessToken: string

  #### Returns string

### emit

- emit(event: "error", error: Error): boolean
- emit(event: "token", token: Token): boolean

- Overrides EventEmitter.emit

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:85

  #### Parameters

  - ##### event: "error"

  - ##### error: Error

  #### Returns boolean

- Overrides EventEmitter.emit

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:86

  #### Parameters

  - ##### event: "token"

  - ##### token: Token

  #### Returns boolean

### eventNames

- eventNames(): Array<string | symbol>

- Inherited from EventEmitter.eventNames

  Overrides EventEmitter.eventNames

  - Defined in node_modules/@types/node/events.d.ts:23

  #### Returns Array<string | symbol>

### generateToken

- generateToken(callback: function): void

- - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:61

  Generates a new XOAuth2 token with the credentials provided at initialization

  #### Parameters

  - ##### callback: function

    - - (err: Error | null, accessToken: string): void

      - #### Parameters

        - ##### err: Error | null

        - ##### accessToken: string

        #### Returns void

### getMaxListeners

- getMaxListeners(): number

- Inherited from EventEmitter.getMaxListeners

  Overrides EventEmitter.getMaxListeners

  - Defined in node_modules/@types/node/events.d.ts:19

  #### Returns number

### getToken

- getToken(renew: boolean, callback: function): void

- - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:55

  Returns or generates (if previous has expired) a XOAuth2 token

  #### Parameters

  - ##### renew: boolean

  - ##### callback: function

    - - (err: Error | null, accessToken: string): void

      - #### Parameters

        - ##### err: Error | null

        - ##### accessToken: string

        #### Returns void

### jwtSignRS256

- jwtSignRS256(payload: object): string

- - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:80

  Creates a JSON Web Token signed with RS256 (SHA256 + RSA)

  #### Parameters

  - ##### payload: object

  #### Returns string

### listenerCount

- listenerCount(type: string | symbol): number

- Inherited from EventEmitter.listenerCount

  Overrides EventEmitter.listenerCount

  - Defined in node_modules/@types/node/events.d.ts:24

  #### Parameters

  - ##### type: string | symbol

  #### Returns number

### listeners

- listeners(event: "error"): Array<function>
- listeners(event: "end"): Array<function>

- Overrides EventEmitter.listeners

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:100

  #### Parameters

  - ##### event: "error"

  #### Returns Array<function>

- Overrides EventEmitter.listeners

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:101

  #### Parameters

  - ##### event: "end"

  #### Returns Array<function>

### off

- off(event: string | symbol, listener: function): this

- Inherited from EventEmitter.off

  Overrides EventEmitter.off

  - Defined in node_modules/@types/node/events.d.ts:16

  #### Parameters

  - ##### event: string | symbol

  - ##### listener: function

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns this

### on

- on(event: "error", listener: function): this
- on(event: "token", listener: function): this

- Overrides EventEmitter.on

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:88

  #### Parameters

  - ##### event: "error"

  - ##### listener: function

    - - (err: Error): void

      - #### Parameters

        - ##### err: Error

        #### Returns void

  #### Returns this

- Overrides EventEmitter.on

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:89

  #### Parameters

  - ##### event: "token"

  - ##### listener: function

    - - (token: Token): void

      - #### Parameters

        - ##### token: Token

        #### Returns void

  #### Returns this

### once

- once(event: "error", listener: function): this
- once(event: "token", listener: function): this

- Overrides EventEmitter.once

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:91

  #### Parameters

  - ##### event: "error"

  - ##### listener: function

    - - (err: Error): void

      - #### Parameters

        - ##### err: Error

        #### Returns void

  #### Returns this

- Overrides EventEmitter.once

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:92

  #### Parameters

  - ##### event: "token"

  - ##### listener: function

    - - (token: Token): void

      - #### Parameters

        - ##### token: Token

        #### Returns void

  #### Returns this

### pipe

- pipe<T>(destination: T, options?: undefined | object): T

- Inherited from internal.pipe

  - Defined in node_modules/@types/node/stream.d.ts:5

  #### Type parameters

  - #### T: WritableStream

  #### Parameters

  - ##### destination: T

  - ##### Optional options: undefined | object

  #### Returns T

### postRequest

- postRequest(url: string, payload: string | Buffer | Readable | object, params: RequestParams, callback: function): void

- - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:74

  Custom POST request handler. This is only needed to keep paths short in Windows – usually this module is a dependency of a dependency and if it tries to require something like the request module the paths get way too long to handle for Windows. As we do only a simple POST request we do not actually require complicated logic support (no redirects, no nothing) anyway.

  #### Parameters

  - ##### url: string

  - ##### payload: string | Buffer | Readable | object

  - ##### params: RequestParams

  - ##### callback: function

    - - (err: Error | null, buf: Buffer): void

      - #### Parameters

        - ##### err: Error | null

        - ##### buf: Buffer

        #### Returns void

### prependListener

- prependListener(event: "error", listener: function): this
- prependListener(event: "end", listener: function): this

- Overrides EventEmitter.prependListener

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:94

  #### Parameters

  - ##### event: "error"

  - ##### listener: function

    - - (err: Error): void

      - #### Parameters

        - ##### err: Error

        #### Returns void

  #### Returns this

- Overrides EventEmitter.prependListener

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:95

  #### Parameters

  - ##### event: "end"

  - ##### listener: function

    - - (token: Token): void

      - #### Parameters

        - ##### token: Token

        #### Returns void

  #### Returns this

### prependOnceListener

- prependOnceListener(event: "error", listener: function): this
- prependOnceListener(event: "end", listener: function): this

- Overrides EventEmitter.prependOnceListener

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:97

  #### Parameters

  - ##### event: "error"

  - ##### listener: function

    - - (err: Error): void

      - #### Parameters

        - ##### err: Error

        #### Returns void

  #### Returns this

- Overrides EventEmitter.prependOnceListener

  - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:98

  #### Parameters

  - ##### event: "end"

  - ##### listener: function

    - - (token: Token): void

      - #### Parameters

        - ##### token: Token

        #### Returns void

  #### Returns this

### rawListeners

- rawListeners(event: string | symbol): Function[]

- Inherited from EventEmitter.rawListeners

  Overrides EventEmitter.rawListeners

  - Defined in node_modules/@types/node/events.d.ts:21

  #### Parameters

  - ##### event: string | symbol

  #### Returns Function[]

### removeAllListeners

- removeAllListeners(event?: string | symbol): this

- Inherited from EventEmitter.removeAllListeners

  Overrides EventEmitter.removeAllListeners

  - Defined in node_modules/@types/node/events.d.ts:17

  #### Parameters

  - ##### Optional event: string | symbol

  #### Returns this

### removeListener

- removeListener(event: string | symbol, listener: function): this

- Inherited from EventEmitter.removeListener

  Overrides EventEmitter.removeListener

  - Defined in node_modules/@types/node/events.d.ts:15

  #### Parameters

  - ##### event: string | symbol

  - ##### listener: function

    - - (...args: any[]): void

      - #### Parameters

        - ##### Rest ...args: any[]

        #### Returns void

  #### Returns this

### setMaxListeners

- setMaxListeners(n: number): this

- Inherited from EventEmitter.setMaxListeners

  Overrides EventEmitter.setMaxListeners

  - Defined in node_modules/@types/node/events.d.ts:18

  #### Parameters

  - ##### n: number

  #### Returns this

### toBase64URL

- toBase64URL(data: Buffer | string): string

- - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:77

  Encodes a buffer or a string into Base64url format

  #### Parameters

  - ##### data: Buffer | string

  #### Returns string

### updateToken

- updateToken(accessToken: string, timeout: s): Token

- - Defined in node_modules/@types/nodemailer/lib/xoauth2.d.ts:58

  Updates token values

  #### Parameters

  - ##### accessToken: string

  - ##### timeout: s

  #### Returns Token

### Static listenerCount

- listenerCount(emitter: EventEmitter, event: string | symbol): number

- Inherited from EventEmitter.listenerCount

  - Defined in node_modules/@types/node/events.d.ts:7
  deprecated

    since v4.0.0

  #### Parameters

  - ##### emitter: EventEmitter

  - ##### event: string | symbol

  #### Returns number

Generated using TypeDoc