@@ -123,16 +123,23 @@ class Particle {
123123 * @param {Object } options.auth Access token
124124 * @param {Object } options.mfaToken Token given from previous step to
125125 * @param {Object } options.otp Current one-time-password generated from the authentication app
126+ * @param {Boolean } options.invalidateTokens Should all tokens be invalidated
126127 * @param {Object } [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
127128 * @param {Object } [options.context] Request context
128129 * @returns {Promise } A promise
129130 */
130- confirmMfa ( { mfaToken, otp, auth, headers, context } ) {
131+ confirmMfa ( { mfaToken, otp, invalidateTokens = false , auth, headers, context } ) {
132+ let data = { mfa_token : mfaToken , otp } ;
133+
134+ if ( invalidateTokens ) {
135+ data . invalidate_tokens = true ;
136+ }
137+
131138 return this . post ( {
132139 uri : '/v1/user/mfa-enable' ,
133140 auth,
134141 headers,
135- data : { mfa_token : mfaToken , otp } ,
142+ data,
136143 context
137144 } ) ;
138145 }
@@ -297,6 +304,23 @@ class Particle {
297304 } ) ;
298305 }
299306
307+ /**
308+ * Revoke all active access tokens
309+ * @param {Object } options Options for this API call
310+ * @param {String } options.auth Access Token
311+ * @param {Object } [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
312+ * @param {Object } [options.context] Request context
313+ * @returns {Promise } A promise
314+ */
315+ deleteActiveAccessTokens ( { auth, headers, context } ) {
316+ return this . delete ( {
317+ uri : '/v1/access_tokens' ,
318+ auth,
319+ headers,
320+ context
321+ } ) ;
322+ }
323+
300324 /**
301325 * Delete the current user
302326 * @param {Object } options Options for this API call
@@ -1065,12 +1089,18 @@ class Particle {
10651089 * @param {String } options.auth Access Token
10661090 * @param {String } options.currentPassword Current password
10671091 * @param {String } options.username New email
1092+ * @param {Boolean } options.invalidateTokens Should all tokens be invalidated
10681093 * @param {Object } [options.headers] Key/Value pairs like `{ 'X-FOO': 'foo', X-BAR: 'bar' }` to send as headers.
10691094 * @param {Object } [options.context] Request context
10701095 * @returns {Promise } A promise
10711096 */
1072- changeUsername ( { currentPassword, username, auth, headers, context } ) {
1097+ changeUsername ( { currentPassword, username, invalidateTokens = false , auth, headers, context } ) {
10731098 const data = { username, current_password : currentPassword } ;
1099+
1100+ if ( invalidateTokens ) {
1101+ data . invalidate_tokens = true ;
1102+ }
1103+
10741104 return this . put ( { uri : '/v1/user' , auth, headers, data, context } ) ;
10751105 }
10761106
0 commit comments