Re-ordered auth section of readme
Project: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/commit/131130a1 Tree: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/tree/131130a1 Diff: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/diff/131130a1 Branch: refs/heads/master Commit: 131130a1598e338072155389c0f0c782a4b74085 Parents: bc2bb98 Author: brandon <[email protected]> Authored: Thu Feb 11 13:27:07 2016 -0800 Committer: brandon <[email protected]> Committed: Thu Feb 11 13:27:07 2016 -0800 ---------------------------------------------------------------------- README.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/blob/131130a1/README.md ---------------------------------------------------------------------- diff --git a/README.md b/README.md index 0ee2c80..e630a3a 100644 --- a/README.md +++ b/README.md @@ -285,25 +285,6 @@ Usergrid.authenticateApp(function(error, usergridResponse, token) { // Usergrid.appAuth is created automatically when this call is successful }) ``` - -### authFallback - -Auth-fallback defines what the client should do when a user token is not present. By default, `Usergrid.authFallback` is set to `UsergridAuth.AUTH_FALLBACK_NONE`, whereby when a token is *not* present, an API call will be performed unauthenticated. If instead `Usergrid.authFallback` is set to `UsergridAuth.AUTH_FALLBACK_APP`, the API call will instead be performed using client credentials, _if_ they're available (i.e. `authenticateApp()` was performed at some point). - -### usingAuth() - -At times it is desireable to have complete, granular control over the authentication context of an API call. To facilitate this, the passthrough function `.usingAuth()` allows you to pre-define the auth context of the next API call. - -```js -// assume Usergrid.authFallback = UsergridAuth.AUTH_FALLBACK_NONE - -Usergrid.usingAuth(Usergrid.appAuth).POST('roles/guest/permissions', { - permission: "get,post,put,delete:/**" -}, function(error, usergridResponse) { - // here we've temporarily used the client credentials to modify permissions - // subsequent calls will not use this auth context -}) -``` ### currentUser and authenticateUser() @@ -330,6 +311,25 @@ Usergrid.authenticateUser({ }) ``` + +### authFallback + +Auth-fallback defines what the client should do when a user token is not present. By default, `Usergrid.authFallback` is set to `UsergridAuth.AUTH_FALLBACK_NONE`, whereby when a token is *not* present, an API call will be performed unauthenticated. If instead `Usergrid.authFallback` is set to `UsergridAuth.AUTH_FALLBACK_APP`, the API call will instead be performed using client credentials, _if_ they're available (i.e. `authenticateApp()` was performed at some point). + +### usingAuth() + +At times it is desireable to have complete, granular control over the authentication context of an API call. To facilitate this, the passthrough function `.usingAuth()` allows you to pre-define the auth context of the next API call. + +```js +// assume Usergrid.authFallback = UsergridAuth.AUTH_FALLBACK_NONE + +Usergrid.usingAuth(Usergrid.appAuth).POST('roles/guest/permissions', { + permission: "get,post,put,delete:/**" +}, function(error, usergridResponse) { + // here we've temporarily used the client credentials to modify permissions + // subsequent calls will not use this auth context +}) +``` ## User operations and convenience methods
