nl_tokens: NB : user and username are used interchangeably . user precedes . options = { user : foo password : bar org : orgname } == > will use the provided password to obtain a token options = { user : foo password : bar org : orgname no_token : true } == > will use HTTP Basic auth with the provided username and password ( no token ) options = { user : foo org : orgname } == > will prompt for password then obtain a token options = { user : foo org : orgname no_token : true } == > will prompt for password then use HTTP Basic auth options = { org : orgname netrc : true } == > will retrieve username and password from . netrc options = { org : orgname ssoZone : foo passcode : xyz } == > will exchange passcode for token within the ssozone
pl_tokens: function maybeGetNewToken ( ) { let user = options . user || options . username ; if ( ! options . passcode && ( ! user || ! options . password ) ) { throw new Error ( "missing username or password" ) ; } if ( ! options . no_token ) { org = new Organization ( c ) ; c . org = org ; let arg1 = { password : options . password } ; // maybe undefined if ( options . mfa_code ) { arg1 . mfa_code = options . mfa_code ; } if ( options . passcode ) { arg1 . passcode = options . passcode ; } return c . getNewToken ( arg1 , function ( e , result ) { cb ( e , org ) ; } ) ; } else { // for some reason, the caller does not want to use tokens c . requestHeaders . authorization = 'Basic ' + common . base64Encode ( user + ':' + options . <mask> ) ; org = new Organization ( c ) ; c . org = org ; return org . get ( '' , function ( e , result ) { cb ( e , org ) ; } ) ; } }