mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
adding OAuth2 options to AuthOptions interface (#16149)
This commit is contained in:
parent
1b390ec9a2
commit
d286c0ac79
24
types/nodemailer-smtp-transport/index.d.ts
vendored
24
types/nodemailer-smtp-transport/index.d.ts
vendored
@ -18,6 +18,30 @@ declare namespace smtpTransport {
|
||||
|
||||
/** indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’ */
|
||||
type?: any;
|
||||
|
||||
/** is the registered client id of the application */
|
||||
clientId?: string;
|
||||
|
||||
/** is the registered client secret of the application */
|
||||
clientSecret?: string;
|
||||
|
||||
/** is an optional refresh token. If it is provided then Nodemailer tries to generate a new access token if existing one expires or fails */
|
||||
refreshToken?: string;
|
||||
|
||||
/** is the access token for the user. Required only if refreshToken is not available and there is no token refresh callback specified */
|
||||
accessToken?: string;
|
||||
|
||||
/** is an optional expiration time for the current accessToken */
|
||||
expires?: number;
|
||||
|
||||
/** is an optional HTTP endpoint for requesting new access tokens. This value defaults to Gmail */
|
||||
accessUrl?: string;
|
||||
|
||||
/** service client id, you can find it from the “client_id” field in the service key file */
|
||||
serviceClient?: string;
|
||||
|
||||
/** is the private key contents, you can find it from the “private_key” field in the service key file */
|
||||
privateKey?: string;
|
||||
}
|
||||
|
||||
export interface SmtpOptions {
|
||||
|
||||
@ -4,7 +4,21 @@ import nodemailer = require('nodemailer');
|
||||
|
||||
var opts: smtpTransport.SmtpOptions = {
|
||||
host: "localhost",
|
||||
port: 25
|
||||
port: 25,
|
||||
auth: {
|
||||
type: 'OAuth2',
|
||||
user: 'user@example.com',
|
||||
// 3LO auth
|
||||
clientId: '000000000000-xxx0.apps.googleusercontent.com',
|
||||
clientSecret: 'XxxxxXXxX0xxxxxxxx0XXxX0',
|
||||
refreshToken: '1/XXxXxsss-xxxXXXXXxXxx0XXXxxXXx0x00xxx',
|
||||
accessToken: 'ya29.Xx_XX0xxxxx-xX0X0XxXXxXxXXXxX0x',
|
||||
expires: 1484314697598,
|
||||
// 2LO auth (test only, dont mix with 3LO)
|
||||
serviceClient: '113600000000000000000',
|
||||
privateKey: '-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBg...',
|
||||
},
|
||||
service: 'Gmail'
|
||||
};
|
||||
|
||||
var transport: nodemailer.Transport = smtpTransport(opts);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user