diff --git a/lib/oauth2.js b/lib/oauth2.js index a3b8617d..bdaae29b 100644 --- a/lib/oauth2.js +++ b/lib/oauth2.js @@ -109,7 +109,8 @@ exports.OAuth2.prototype.getOAuthAccessToken= function(code, params, callback) { params['client_id'] = this._clientId; params['client_secret'] = this._clientSecret; params['type']= 'web_server'; - params['code']= code; + var codeParam = (params.grant_type === 'refresh_token') ? 'refresh_token' : 'code'; + params[codeParam]= code; var post_data= querystring.stringify( params ); var post_headers= {