Skip to content

Instantly share code, notes, and snippets.

@tlvince
Created October 16, 2015 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlvince/b4214358a84272bd46df to your computer and use it in GitHub Desktop.
Save tlvince/b4214358a84272bd46df to your computer and use it in GitHub Desktop.
Reduced test case for angular-eha.couchdb-auth
<html ng-app="test">
<body>
<script src="https://cdn.jsdelivr.net/angularjs/1.4.6/angular.min.js"></script>
<script src="https://cdn.jsdelivr.net/pouchdb/4.0.0/pouchdb.min.js"></script>
<script src="https://cdn.jsdelivr.net/localforage/1.2.2/localforage.min.js"></script>
<script src="https://cdn.jsdelivr.net/lodash/3.5.0/lodash.min.js"></script>
<script src="https://cdn.rawgit.com/nolanlawson/pouchdb-authentication/master/dist/pouchdb.authentication.min.js"></script>
<script src="https://cdn.jsdelivr.net/restangular/1.4.0/restangular.min.js"></script>
<script src="https://cdn.rawgit.com/ocombe/angular-localForage/master/dist/angular-localForage.min.js"></script>
<script src="https://cdn.rawgit.com/eHealthAfrica/angular-eha.couchdb-auth/master/dist/couchdb-auth.min.js"></script>
<script>
angular.module('test', [
'eha.couchdb-auth'
])
.config(function(ehaCouchDbAuthServiceProvider) {
ehaCouchDbAuthServiceProvider.config({
url: 'https://eha-auth-test.iriscouch.com'
})
})
.run(function(ehaCouchDbAuthService) {
ehaCouchDbAuthService.signIn({
username: 'admin',
password: 'admin'
})
.then(console.log.bind(console))
.then(function() {
var db = new PouchDB('https://eha-auth-test.iriscouch.com/test')
return db.info()
})
.then(console.log.bind(console))
.catch(console.error.bind(console))
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment