Implement state parameter, generate random string for verification

This commit is contained in:
Ryan Warsaw 2017-06-30 14:26:18 -05:00
Родитель f01ba82a3e
Коммит 6f48a34f4e
1 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -31,12 +31,20 @@ util.inherits(Strategy, OAuth2Strategy);
*/
Strategy.prototype.authorizationParams = function(options) {
var params = {};
if (options.action) { params['action'] = options.action; }
if (options.action) {
params['action'] = options.action;
}
// This is just to get around a temporary bug of Webmaker calling "scope" as "scopes" and therefore rejecting "scope".
if (options.scope) {
params['scopes'] = options.scope;
options.scope = null;
}
//TODO: Implement state verification, to prevent CSRF attacks
options.state = options.state || Math.random().toString(36).substring(2, 8);
return params;
};