diff --git a/lib/extensions.js b/lib/extensions.js index 6d08f1df..f2f034c5 100644 --- a/lib/extensions.js +++ b/lib/extensions.js @@ -104,6 +104,19 @@ module.exports = function(realmConstructor) { setConstructorOnPrototype(realmConstructor.Sync.User); setConstructorOnPrototype(realmConstructor.Sync.Session); + + if (realmConstructor.Sync._setFeatureToken) { + realmConstructor.Sync.setFeatureToken = function(featureToken) { + if (typeof featureToken !== 'string' || !featureToken instanceof String) { + throw new Error("featureToken should be a string"); + } + + realmConstructor.Sync._setFeatureToken(featureToken.trim()); + } + + //enable deprecated setAccessToken + realmConstructor.Sync.setAccessToken = realmConstructor.Sync.setFeatureToken; + } } // TODO: Remove this now useless object.