common/models/README.md
Application model represents the metadata for a client application that has its own identity and associated configuration with the LoopBack server.
The following keys are automatically generated by the application creation process. They can be reset upon request.
The application can be configured to support multiple methods of push notifications.
pushSettings
pushSettings: { apns: { certData: config.apnsCertData, keyData: config.apnsKeyData, production: false, // Development mode pushOptions: { // Extra options can go here for APN }, feedbackOptions: { batchFeedback: true, interval: 300 } }, gcm: { serverApiKey: config.gcmServerApiKey } }
In addition to the CRUD methods, the Application model also has the following apis:
You can register a new application by providing the owner user id, application name, and other properties in the options object.
Application.register('rfeng', 'MyApp1',
{description: 'My first loopback application'},
function (err, result) {
var app = result;
...
});
You can reset keys for a given application by id.
Application.resetKeys(appId, function (err, result) {
var app = result;
...
});
You can authenticate an application by id and one of the keys. If successful, it calls back with the key name in the result argument. Otherwise, the keyName is null.
Application.authenticate(appId, clientKey, function (err, keyName) {
assert.equal(keyName, 'clientKey');
...
});