Skip to content

Commit

Permalink
Use client_secret instead of access_token for authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
victor-cronofy committed Jun 27, 2022
1 parent 65e39b2 commit 2386607
Showing 1 changed file with 27 additions and 8 deletions.
35 changes: 27 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,27 +495,46 @@ cronofy.prototype.conferencingServiceAuthorizations = function () {
};

cronofy.prototype.createBookableEvent = function () {
const details = this._parseArguments(arguments, ['access_token']);
var details = this._parseArguments(arguments, ['client_secret']);
details.options.bearer_token = details.options.client_secret;

return this._httpPost('/v1/bookable_events', details.options, details.callback);
return this._httpPost('/v1/bookable_events', details.options, details.callback, ['client_secret']);
};

cronofy.prototype.readBookableEvents = function () {
const details = this._parseArguments(arguments, ['access_token']);
var details = this._parseArguments(arguments, ['client_secret']);
details.options.bearer_token = details.options.client_secret;

return this._httpGet('/v1/bookable_events' + '/' + details.options.bookable_event_id, details.options, details.callback);
return this._httpGet(
'/v1/bookable_events/' + details.options.bookable_event_id,
details.options,
details.callback,
['client_secret']
);
};

cronofy.prototype.upsertRegistrationBookableEvent = function () {
const details = this._parseArguments(arguments, ['access_token']);
var details = this._parseArguments(arguments, ['client_secret']);
details.options.bearer_token = details.options.client_secret;

return this._httpPost('/v1/bookable_events' + '/' + details.options.bookable_event_id + '/' + 'registrations', details.options, details.callback);
return this._httpPost(
'/v1/bookable_events/' + details.options.bookable_event_id + '/registrations',
details.options,
details.callback,
['client_secret']
);
};

cronofy.prototype.deleteRegistrationBookableEvent = function () {
const details = this._parseArguments(arguments, ['access_token']);
var details = this._parseArguments(arguments, ['client_secret']);
details.options.bearer_token = details.options.client_secret;

return this._httpDelete('/v1/bookable_events' + '/' + details.options.bookable_event_id + '/' + 'registrations' + '/' + details.options.registration_id, details.options, details.callback);
return this._httpDelete(
'/v1/bookable_events/' + details.options.bookable_event_id + '/registrations/' + details.options.registration_id,
details.options,
details.callback,
['client_secret']
);
};

module.exports = cronofy;

0 comments on commit 2386607

Please sign in to comment.