@@ -9,12 +9,14 @@ var req = require( 'superagent' ),
9
9
*/
10
10
var config = require ( 'config' ) ;
11
11
12
- const oauth = {
13
- client_id : config ( 'desktop_oauth_client_id' ) ,
14
- client_secret : config ( 'desktop_oauth_client_secret' ) ,
15
- wpcom_supports_2fa : true ,
16
- grant_type : 'password'
17
- } ;
12
+ function oauth ( ) {
13
+ return {
14
+ client_id : config ( 'desktop_oauth_client_id' ) ,
15
+ client_secret : config ( 'desktop_oauth_client_secret' ) ,
16
+ wpcom_supports_2fa : true ,
17
+ grant_type : 'password'
18
+ }
19
+ }
18
20
19
21
/*
20
22
* Proxies an oauth login request to the WP API
@@ -25,7 +27,7 @@ function proxyOAuth( request, response ) {
25
27
var data = Object . assign ( { } , {
26
28
username : request . body . username ,
27
29
password : request . body . password
28
- } , oauth ) ;
30
+ } , oauth ( ) ) ;
29
31
30
32
if ( request . body . auth_code ) {
31
33
// Pass along the one-time password
@@ -78,7 +80,7 @@ function sms( request, response ) {
78
80
username : request . body . username ,
79
81
password : request . body . password ,
80
82
wpcom_resend_otp : true
81
- } , oauth ) ;
83
+ } , oauth ( ) ) ;
82
84
83
85
req . post ( config ( 'desktop_oauth_token_endpoint' ) )
84
86
. type ( 'form' )
0 commit comments