getURLFromState: function (state) { var thisURL = new URI(this.getLocalURL()); thisURL.removeQuery('state'); if (!_.isEmpty(state)) { var statesString = JSON.stringify(state); thisURL.setQuery('state', statesString); } return thisURL.toString(); },
core.storeState(stateObj, function(err, stateTok) { // Construct authorization redirect var uri = new URI(conf['authorization_endpoint']); uri .addQuery({state: stateTok}) .addQuery(params) .addQuery({'client_id': resp['client_id']}); // Do not send client_secret here uri.removeQuery('client_secret'); // Redirect the user to constructed uri return redirect(err, uri && uri.toString()); });