Blame view

node_modules/loopback/common/models/README.md 3.11 KB
f7563de62   Palak Handa   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
  # Application
  
  Application model represents the metadata for a client application that has its
  own identity and associated configuration with the LoopBack server.
  
  ## Each application has the following basic properties:
  
  * id: Automatically generated id
  * name: Name of the application (required)
  * description: Description of the application (optional)
  * icon: URL of the icon
  * status: Status of the application, such as production/sandbox/disabled
  * created: Timestamp of the record being created
  * modified: Timestamp of the record being modified
  
  ## An application has the following properties linking to users:
  
  * owner: The user id of the developer who registers the application
  * collaborators: A array of users ids who have permissions to work on this app
  
  ## oAuth 2.0 settings
  
  * url: The application url
  * callbackUrls: An array of preregistered callback urls for oAuth 2.0
  * permissions: An array of oAuth 2.0 scopes that can be requested by the application
  
  ## Security keys
  
  The following keys are automatically generated by the application creation
  process. They can be reset upon request.
  
  * clientKey: Secret for mobile clients
  * javaScriptKey: Secret for JavaScript clients
  * restApiKey: Secret for REST APIs
  * windowsKey: Secret for Windows applications
  * masterKey: Secret for REST APIS. It bypasses model level permissions
  
  ## Push notification settings
  
  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
          }
        }
  
  
  ## Authentication schemes
  
  * authenticationEnabled
  * anonymousAllowed
  * authenticationSchemes
  
  ### Authentication scheme settings
  
  * scheme: Name of the authentication scheme, such as local, facebook, google,
  twitter, linkedin, github
  * credential: Scheme-specific credentials
  
  ## APIs for Application model
  
  In addition to the CRUD methods, the Application model also has the following
  apis:
  
  ### Register a new application
  
  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;
          ...
      });
  
  ### Reset keys
  
  You can reset keys for a given application by id.
  
      Application.resetKeys(appId, function (err, result) {
          var app = result;
          ...
      });
  
  ### Authenticate by appId and key
  
  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');
              ...
      });