@@ -136,7 +136,7 @@ _.extend(Environment.prototype, {
136136 // clientId: constants.XPLAT_CLI_CLIENT_ID
137137 authorityUrl : this . apiTokenEndpointUrl ,
138138 apiVersion : this . apiVersion ,
139- // token: token,
139+ token : token ,
140140 resourceId : this . apiEndpointUrl ,
141141 clientId : constants . DNSIMPLE_CLI_CLIENT_ID
142142 } ;
@@ -174,23 +174,19 @@ _.extend(Environment.prototype, {
174174 callback ( null , subs ) ;
175175 }
176176
177- if ( ! token ) {
178- subscriptionUtils . getSubscriptions ( self , username , password , processSubscriptions ) ;
179- } else {
180- dnsimpleAuth . acquireServicePrincipalToken ( self . getAuthConfig ( token ) , username , password , function ( err , token ) {
181- if ( err ) { return callback ( err ) ; }
182- subscriptionUtils . getSubscriptionsInTenant ( self , username , tenant , token , processSubscriptions ) ;
183- } ) ;
184- }
177+ subscriptionUtils . getSubscriptions ( self , username , token , password , processSubscriptions ) ;
185178 } ,
186179
187180 acquireToken : function ( username , password , token , callback ) {
188181 dnsimpleAuth . acquireToken ( this . getAuthConfig ( token ) , username , password , callback ) ;
189182 } ,
190183
191184 getDnsimpleClient : function ( credentials ) {
192- return new dnsimple ( { email : credentials . userId , token : credentials . accessToken , hostname : this . apiEndpointUrl . replace ( 'https://' , '' ) } ) ;
193- //return resourceClient.createResourceSubscriptionClient(credentials, this.resourceManagerEndpointUrl);
185+ var options = { email : credentials . userId } ;
186+ options [ 'token' ] = credentials . authConfig . token || credentials . accessToken ;
187+ options [ 'hostname' ] = this . apiEndpointUrl . replace ( 'https://' , '' ) ;
188+ var dns = new dnsimple ( options ) ;
189+ return dns ;
194190 }
195191} ) ;
196192
0 commit comments