shernshiou / node-uber

Uber API nodejs wrapper
MIT License
188 stars 66 forks source link

Enhancement: State Parameter Support With Authentication Workflow #77

Open gjsjy opened 3 years ago

gjsjy commented 3 years ago

Hi,

Is there possibility to enhance getAuthorizeUrl to include "State" parameter?

var authURL = oauth2.getAuthorizeUrl({ redirect_uri: 'http://localhost:8080/code', scope: ['repo', 'user'], state: 'some random string to protect against cross-site request forgery attacks' });

Currently not passing down that params to OAuth

Uber.prototype.getAuthorizeUrl = function getAuthorizeUrl(scope) { if (!Array.isArray(scope)) { return new Error('Scope is not an array'); } if (scope.length === 0) { return new Error('Scope is empty'); } return this.oauth2.getAuthorizeUrl({ response_type: 'code', redirect_uri: this.defaults.redirect_uri, scope: scope.join(' ') }); };

I appreciate your help here.

Thanks, Jo