[NEW][API] Endpoint `settings.addCustomOAuth` to create Custom OAuth services (#14912)

pull/14085/head^2
Greg Rauhöft 5 years ago committed by GitHub
parent 53c4ecf610
commit 16d5da214f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      app/api/server/v1/settings.js

@ -64,6 +64,21 @@ API.v1.addRoute('settings.oauth', { authRequired: false }, {
},
});
API.v1.addRoute('settings.addCustomOAuth', { authRequired: true }, {
post() {
if (!this.requestParams().name || !this.requestParams().name.trim()) {
throw new Meteor.Error('error-name-param-not-provided', 'The parameter "name" is required');
}
Meteor.runAsUser(this.userId, () => {
Meteor.call('addOAuthService', this.requestParams().name, this.userId);
});
return API.v1.success();
},
});
API.v1.addRoute('settings', { authRequired: true }, {
get() {
const { offset, count } = this.getPaginationItems();

Loading…
Cancel
Save