You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// create an API session (user is not authenticated)
59
-
QB.createSession(function(err, result) {
60
-
if (err) {
61
-
console.log('Something went wrong: '+ err);
62
-
} else {
63
-
console.log('Session created with id '+result.id);
64
-
}
65
-
});
66
-
67
-
// list the users currently enrolled
68
-
QB.users.listUsers(function(err, result) {
69
-
for (var i=0; i <result.items.length; i++) {
70
-
console.log('User '+result.items[i].login+' is registered');
71
-
}
72
-
});
73
-
```
74
-
75
-
Alternative initialisation
76
-
--------------------------
53
+
[QuickBlox JavaScript SDK, zip archive](https://github.com/QuickBlox/quickblox-javascript-sdk/archive/gh-pages.zip)
77
54
78
-
Based on user feedback it is now also possible to initialise the SDK using an existing token. This means you can generate a token elsewhere, for example serverside, and then use this token instead of initialising the SDK with your application key and secret.
79
-
80
-
The above simple example can then be coded as shown bellow:
console.log('User '+result.items[i].login+' is registered');
90
-
}
91
-
});
92
-
````
93
-
94
-
Passing configuration options
95
-
----------------------
96
-
97
-
Sometimes you will want to pass some configuration options such as a different enterprise endpoint, to enable/disable SSL, setting a timeout for your requests, or turn on debugging. You can dothis by passing an `object` as a fourth parameter to `QB.init()`, like so:
The code above would then make `QB` make API requests to `http://api.differenthost.com/` rather than `https://api.quickblox.com` and would give you full debugging to the console. It would also set a 5 second timeout for all your requests, triggering the `error` callback.
120
-
121
-
Documentation
122
-
----------------------
55
+
# Documentation
123
56
124
57
You can look at it here http://quickblox.com/developers/Javascript
125
58
126
-
Questions and feedback
127
-
----------------------
59
+
# Questions and feedback
128
60
129
61
Please raise questions, requests for help etc. via http://stackoverflow.com/questions/tagged/quickblox
130
62
131
63
Feedback and suggestions for improvement always welcome :)
132
64
65
+
# Modifying and building the library
133
66
134
-
Creating sessions in more detail
135
-
--------------------------------
136
-
```
137
-
QB.createSession(options, callback)
138
-
139
-
options: A map of additional options to pass to the method
140
-
appId - your application's id (overrides the value passed to QB.init)
141
-
authKey - your application's authorization key (overrides the value passed to QB.init)
142
-
authSecret - your application's authorization secret (overrides the value passed to QB.init)
143
-
login - the QuickBlox username of the person to login
144
-
password - the QuickBlox user's password
145
-
email - the email address of the QuickBlox user
146
-
provider - the name of the social network provider for authenticating via Twitter of Facebook
147
-
scope - a list of permisions required by the facebook app
148
-
keys - a map of :
149
-
token - social network access token
150
-
secret - social network access token secret (only required for twitter)
151
-
```
152
-
153
-
Please take a look at the specs for examples of how to use the APIs. In essence the JavaScript SDK is a thin facade to the REST API, so reading the docs [http://quickblox.com/developers/Overview] is strongly recommended :)
154
-
155
-
156
-
Modifying and building the library
157
-
----------------------------------
158
67
The quickblox.js library is build from a number of **CommonJS modules** contained in the `js` folder. For example the `js/modules/qbUsers.js` module contains the code that deals with the [Users API](http://quickblox.com/developers/Users).
159
68
160
69
These modules are combined through [browserify](http://browserify.org/) into a single `quickblox.js` file in the root and so this is the only file that needs to be included in a `<script>` tag OR in a RequireJS application OR in Node.js environment (everywhere). To build the library, use the [Grunt](http://gruntjs.com/) task runner:
@@ -169,4 +78,5 @@ These modules are combined through [browserify](http://browserify.org/) into a s
169
78
*`npm publish`. This action updates SDK for node package manager, but maybe you will be needed some author credentials for it (you should be in owner list)
0 commit comments