@@ -13,10 +13,10 @@ const getAccessToken = function () {
1313 if ( ! this . options . clientID ) throw new Error ( 'Missing Client ID' ) ;
1414 if ( ! this . options . clientSecret ) throw new Error ( 'Missing Client Secret or Cert Id' ) ;
1515 if ( ! this . options . body ) throw new Error ( 'Missing Body, required Grant type' ) ;
16- let scopesParam = this . options . body . scope
17- ? Array . isArray ( this . options . body . scope )
18- ? this . options . body . scope . join ( '%20' )
19- : this . options . body . scope
16+ const scopesParam = this . options . body . scopes
17+ ? Array . isArray ( this . options . body . scopes )
18+ ? this . options . body . scopes . join ( '%20' )
19+ : this . options . body . scopes
2020 : DEFAULT_API_SCOPE ;
2121 this . options . data = qs . stringify ( {
2222 grant_type : 'client_credentials' ,
@@ -44,10 +44,10 @@ const getUserAuthorizationUrl = function (state = null) {
4444 if ( ! this . options . clientSecret ) throw new Error ( 'Missing Client Secret or Cert Id' ) ;
4545 if ( ! this . options . body ) throw new Error ( 'Missing Body, required Grant type' ) ;
4646 if ( ! this . options . redirectUri ) throw new Error ( 'redirect_uri is required for redirection after sign in\nkindly check here https://developer.ebay.com/api-docs/static/oauth-redirect-uri.html' ) ;
47- let scopesParam = this . options . body . scopes
48- ? Array . isArray ( this . options . body . scopes )
49- ? this . options . body . scopes . join ( '%20' )
50- : this . options . body . scopes
47+ const scopesParam = this . options . body . scope
48+ ? Array . isArray ( this . options . body . scope )
49+ ? this . options . body . scope . join ( '%20' )
50+ : this . options . body . scope
5151 : DEFAULT_API_SCOPE ;
5252 let queryParam = `client_id=${ this . options . clientID } ` ;
5353 queryParam += `&redirect_uri=${ this . options . redirectUri } ` ;
@@ -77,7 +77,7 @@ const getUserTokenByCode = function (code) {
7777 const self = this ;
7878 const encodedStr = base64Encode ( `${ this . options . clientID } :${ this . options . clientSecret } ` ) ;
7979 const auth = `Basic ${ encodedStr } ` ;
80- return makeRequest ( this . options , '/identity/v1/oauth2/token' , 'POST' , auth ) . then ( result => {
80+ return makeRequest ( this . options , '/identity/v1/oauth2/token' , 'POST' , auth ) . then ( ( result ) => {
8181 const resultJSON = JSON . parse ( result ) ;
8282 if ( ! resultJSON . error ) self . setUserAccessToken ( resultJSON ) ;
8383 return resultJSON ;
@@ -88,7 +88,7 @@ const getUserTokenByCode = function (code) {
8888 * Use a refresh token to update a User access token (Updating the expired access token)
8989 *
9090 * @param refreshToken refresh token, defaults to pre-assigned refresh token
91- * @param scopes array of scopes for the access token
91+ * @param scope array of scopes for the access token
9292 * @return userAccessToken object (without refresh_token)
9393*/
9494const getUserTokenByRefresh = function ( refreshToken = null ) {
@@ -99,10 +99,10 @@ const getUserTokenByRefresh = function (refreshToken = null) {
9999 throw new Error ( 'Refresh token is required, to generate refresh token use getUserTokenByCode method' ) ; // eslint-disable-line max-len
100100 }
101101 refreshToken = refreshToken ? refreshToken : this . options . refreshToken ;
102- let scopesParam = this . options . body . scopes
103- ? Array . isArray ( this . options . body . scopes )
104- ? this . options . body . scopes . join ( '%20' )
105- : this . options . body . scopes
102+ const scopesParam = this . options . body . scope
103+ ? Array . isArray ( this . options . body . scope )
104+ ? this . options . body . scope . join ( '%20' )
105+ : this . options . body . scope
106106 : DEFAULT_API_SCOPE ;
107107 this . options . data = qs . stringify ( {
108108 refresh_token : refreshToken ,
@@ -113,7 +113,7 @@ const getUserTokenByRefresh = function (refreshToken = null) {
113113 const self = this ;
114114 const encodedStr = base64Encode ( `${ this . options . clientID } :${ this . options . clientSecret } ` ) ;
115115 const auth = `Basic ${ encodedStr } ` ;
116- return makeRequest ( this . options , '/identity/v1/oauth2/token' , 'POST' , auth ) . then ( result => {
116+ return makeRequest ( this . options , '/identity/v1/oauth2/token' , 'POST' , auth ) . then ( ( result ) => {
117117 const resultJSON = JSON . parse ( result ) ;
118118 if ( ! resultJSON . error ) self . setUserAccessToken ( resultJSON ) ;
119119 return resultJSON ;
0 commit comments