Kinvey JavaScript SDK
The Kinvey JavaScript SDK (kinvey-js-sdk) provided a client-side interface for interacting with the Kinvey Mobile Backend as a Service (MBaaS) platform. Designed to simplify backend development, it offered functionalities like data storage, user management, authentication, and file storage, allowing developers to focus on front-end logic for web and mobile applications. The SDK aimed to provide a low-code approach, integrating with various JavaScript frameworks such as Angular, React, NativeScript, Vue, and HTML5. The current stable version, 8.0.0, was last published in mid-2020. However, the Kinvey platform, and by extension its SDKs, has been explicitly sunsetted and is no longer actively maintained or supported by Progress Software, with many related GitHub repositories archived since 2019 or early 2025. There is no ongoing release cadence.
Common errors
-
error: "The Authorization header in your request is malformed. An Authorization header should contain two parts separated by a space: a type (Basic or Kinvey) and a base64-encoded auth string.
cause Incorrectly formatted Authorization header in HTTP requests, often due to a missing space after 'Basic' or 'Kinvey' in the header string.fixEnsure the Authorization header string adheres strictly to the `Type Base64String` format, including the space, for example, `Authorization: Basic <base64-encoded-credentials>`. -
Kinvey.init is not a function or is undefined
cause The Kinvey SDK was not properly initialized or imported. This often happens if `Kinvey` is imported incorrectly (e.g., default import instead of namespace import) or if `Kinvey.init()` is called before the SDK is fully loaded.fixEnsure `import * as Kinvey from 'kinvey-js-sdk';` is used for the main entry point and that `Kinvey.init()` is called only after the SDK module has been fully evaluated. Check for typos in method names.
Warnings
- breaking The Kinvey platform has been officially sunsetted and is no longer actively supported or maintained by Progress Software. All users are advised to migrate to an alternative backend solution. This SDK will not receive further updates or security patches.
- deprecated Many Kinvey-related GitHub repositories, including those for specific SDK shims (e.g., HTML5, NativeScript, Node.js), have been archived and are now read-only, indicating that these components are no longer in active development.
- gotcha Older versions of various Kinvey SDKs frequently used CommonJS `require()` syntax. While `kinvey-js-sdk` v8.0.0 provides TypeScript declarations, modern bundlers and Node.js environments may prefer or enforce ESM `import` statements.
Install
-
npm install kinvey-js-sdk -
yarn add kinvey-js-sdk -
pnpm add kinvey-js-sdk
Imports
- Kinvey
const Kinvey = require('kinvey-js-sdk');import * as Kinvey from 'kinvey-js-sdk';
- DataStore
import DataStore from 'kinvey-js-sdk/DataStore';
import { DataStore } from 'kinvey-js-sdk'; - User
import { User } from 'kinvey-js-sdk';
Quickstart
import * as Kinvey from 'kinvey-js-sdk';
const APP_KEY = process.env.KINVEY_APP_KEY ?? '';
const APP_SECRET = process.env.KINVEY_APP_SECRET ?? '';
async function initializeAndLogin() {
try {
if (!APP_KEY || !APP_SECRET) {
throw new Error('Kinvey App Key and App Secret must be provided via environment variables.');
}
// 1. Initialize Kinvey SDK
await Kinvey.init({
appKey: APP_KEY,
appSecret: APP_SECRET,
// Optional: Set masterSecret if using a Node.js environment
// masterSecret: process.env.KINVEY_MASTER_SECRET
});
console.log('Kinvey SDK initialized successfully.');
// 2. Login a user (or signup)
let user;
try {
user = await Kinvey.User.login('testuser', 'password123');
console.log(`User 'testuser' logged in:`, user.data);
} catch (error) {
if (error.statusCode === 401) { // User not found, attempt signup
user = await Kinvey.User.signup('testuser', 'password123');
console.log(`User 'testuser' signed up and logged in:`, user.data);
} else {
throw error;
}
}
// 3. Access a data collection
const collection = Kinvey.DataStore.collection('myCollection');
// 4. Create and save a new entity
const entity = await collection.save({ message: 'Hello Kinvey!', timestamp: new Date() });
console.log('Saved entity:', entity);
// 5. Fetch entities
const query = new Kinvey.Query();
query.greaterThan('timestamp', new Date(Date.now() - 24 * 60 * 60 * 1000)); // Last 24 hours
const entities = await collection.find(query).toPromise();
console.log('Fetched entities:', entities);
} catch (error) {
console.error('Kinvey operation failed:', error.message || error);
}
}
initializeAndLogin();