creating a Pouchdb authentication with Couchdb The Next CEO of Stack OverflowCreate GUID / UUID in JavaScript?Creating multiline strings in JavaScriptWhat is JSONP, and why was it created?Getting error Property 'openDatabase' does not exist on type 'SQLite' in ionic3 project?Storage injection problems in ionicUncaught (in promise): TypeError: Cannot read property 'create' of undefined (ionic 3.9 , Angularjs 5.0.3)Angular 6.1 StaticInjectorErrorstaticInjection error(AppModule) : ionic 3I want to filter the list angularfire2. that is not workingGetting the current URL gives the static injector error for Router

Why do remote US companies require working in the US?

Method for adding error messages to a dictionary given a key

A small doubt about the dominated convergence theorem

Is it convenient to ask the journal's editor for two additional days to complete a review?

Newlines in BSD sed vs gsed

Why do airplanes bank sharply to the right after air-to-air refueling?

Can MTA send mail via a relay without being told so?

Unclear about dynamic binding

What does "Its cash flow is deeply negative" mean?

What connection does MS Office have to Netscape Navigator?

Should I tutor a student who I know has cheated on their homework?

Proper way to express "He disappeared them"

A Man With a Stainless Steel Endoskeleton (like The Terminator) Fighting Cloaked Aliens Only He Can See

How to place nodes around a circle from some initial angle?

Domestic-to-international connection at Orlando (MCO)

RigExpert AA-35 - Interpreting The Information

I believe this to be a fraud - hired, then asked to cash check and send cash as Bitcoin

How do I align (1) and (2)?

Is a distribution that is normal, but highly skewed considered Gaussian?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

WOW air has ceased operation, can I get my tickets refunded?

The past simple of "gaslight" – "gaslighted" or "gaslit"?

Is it possible to replace duplicates of a character with one character using tr

Flying from Cape Town to England and return to another province



creating a Pouchdb authentication with Couchdb



The Next CEO of Stack OverflowCreate GUID / UUID in JavaScript?Creating multiline strings in JavaScriptWhat is JSONP, and why was it created?Getting error Property 'openDatabase' does not exist on type 'SQLite' in ionic3 project?Storage injection problems in ionicUncaught (in promise): TypeError: Cannot read property 'create' of undefined (ionic 3.9 , Angularjs 5.0.3)Angular 6.1 StaticInjectorErrorstaticInjection error(AppModule) : ionic 3I want to filter the list angularfire2. that is not workingGetting the current URL gives the static injector error for Router










2















I'm trying to create a system with couchdb@2.X and pouchdb@6.4.2, and I'm struggling to make the authentication code with db-per-user, I understood the general idea (kind of) and trying to search for an example or to fix my code, here is what I've did until now:



import Injectable from '@angular/core';
import PouchDB from 'pouchdb';
import PouchAuth from 'pouchdb-authentication';
import syncResult from './../../models/syncResult'
import credentials from '../../models/credentials';
PouchDB.plugin(PouchAuth);

/*
Generated class for the PouchDbServiceProvider provider.

See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class PouchDbServiceProvider {

url:any;
private localDB: any;
private remoteDB:any;
username: string;
password: string;
constructor(private pendingSync: Promise<syncResult>)



singUp(user,pass)
this.teardown();

let options =
live:true,
retry:true,
continuous:true,
auth:
username: user,
password: pass



this.localDB = new PouchDB(this.getDBname(user));
this.remoteDB = new PouchDB('http://localhost:5984/'+this.getDBname(user),options);
this.localDB.sync(this.remoteDB,options);


private getDBname(userIdentifier:string)
var dbName = userIdentifier.toLowerCase().replace(/[^a-z0-9_$()+-]/g, "-");
return (dbName);


public teardown()

if(!this.localDB)
return;

this.localDB.close();
this.localDB = null;
this.remoteDB.close();
this.remoteDB = null;



Above is the provider that deals (or had to) with the sync between local and remote. The error I have is next:



 Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[PouchDbServiceProvider -> t]: 
StaticInjectorError(Platform: core)[PouchDbServiceProvider -> t]:
NullInjectorError: No provider for t!
Error: StaticInjectorError(AppModule)[PouchDbServiceProvider -> t]:
StaticInjectorError(Platform: core)[PouchDbServiceProvider -> t]:
NullInjectorError: No provider for t!
at _NullInjector.get (http://localhost:8100/build/vendor.js:1377:19)
at resolveToken (http://localhost:8100/build/vendor.js:1675:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1485:20)
at resolveToken (http://localhost:8100/build/vendor.js:1675:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1485:20)
at resolveNgModuleDep (http://localhost:8100/build/vendor.js:11270:25)
at _createClass (http://localhost:8100/build/vendor.js:11307:29)
at _createProviderInstance$1 (http://localhost:8100/build/vendor.js:11281:26)
at c (http://localhost:8100/build/polyfills.js:3:19752)
at Object.reject (http://localhost:8100/build/polyfills.js:3:19174)
at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:51765:16)
at NavControllerBase._failed (http://localhost:8100/build/vendor.js:51758:14)
at http://localhost:8100/build/vendor.js:51805:59
at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
at Object.onInvoke (http://localhost:8100/build/vendor.js:5134:33)
at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
at r.run (http://localhost:8100/build/polyfills.js:3:10143)
at http://localhost:8100/build/polyfills.js:3:20242


I know there are many mistakes but I couldn't find some recent help, all the posts I see are old or not clearly documented ( or I'm stupid, if this option, show me the right way haha)










share|improve this question
























  • PS: I look at the couchdb documentation and understand what is saying but can't figure out how to code that idea

    – Daniel Saito
    Mar 21 at 18:46















2















I'm trying to create a system with couchdb@2.X and pouchdb@6.4.2, and I'm struggling to make the authentication code with db-per-user, I understood the general idea (kind of) and trying to search for an example or to fix my code, here is what I've did until now:



import Injectable from '@angular/core';
import PouchDB from 'pouchdb';
import PouchAuth from 'pouchdb-authentication';
import syncResult from './../../models/syncResult'
import credentials from '../../models/credentials';
PouchDB.plugin(PouchAuth);

/*
Generated class for the PouchDbServiceProvider provider.

See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class PouchDbServiceProvider {

url:any;
private localDB: any;
private remoteDB:any;
username: string;
password: string;
constructor(private pendingSync: Promise<syncResult>)



singUp(user,pass)
this.teardown();

let options =
live:true,
retry:true,
continuous:true,
auth:
username: user,
password: pass



this.localDB = new PouchDB(this.getDBname(user));
this.remoteDB = new PouchDB('http://localhost:5984/'+this.getDBname(user),options);
this.localDB.sync(this.remoteDB,options);


private getDBname(userIdentifier:string)
var dbName = userIdentifier.toLowerCase().replace(/[^a-z0-9_$()+-]/g, "-");
return (dbName);


public teardown()

if(!this.localDB)
return;

this.localDB.close();
this.localDB = null;
this.remoteDB.close();
this.remoteDB = null;



Above is the provider that deals (or had to) with the sync between local and remote. The error I have is next:



 Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[PouchDbServiceProvider -> t]: 
StaticInjectorError(Platform: core)[PouchDbServiceProvider -> t]:
NullInjectorError: No provider for t!
Error: StaticInjectorError(AppModule)[PouchDbServiceProvider -> t]:
StaticInjectorError(Platform: core)[PouchDbServiceProvider -> t]:
NullInjectorError: No provider for t!
at _NullInjector.get (http://localhost:8100/build/vendor.js:1377:19)
at resolveToken (http://localhost:8100/build/vendor.js:1675:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1485:20)
at resolveToken (http://localhost:8100/build/vendor.js:1675:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1485:20)
at resolveNgModuleDep (http://localhost:8100/build/vendor.js:11270:25)
at _createClass (http://localhost:8100/build/vendor.js:11307:29)
at _createProviderInstance$1 (http://localhost:8100/build/vendor.js:11281:26)
at c (http://localhost:8100/build/polyfills.js:3:19752)
at Object.reject (http://localhost:8100/build/polyfills.js:3:19174)
at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:51765:16)
at NavControllerBase._failed (http://localhost:8100/build/vendor.js:51758:14)
at http://localhost:8100/build/vendor.js:51805:59
at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
at Object.onInvoke (http://localhost:8100/build/vendor.js:5134:33)
at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
at r.run (http://localhost:8100/build/polyfills.js:3:10143)
at http://localhost:8100/build/polyfills.js:3:20242


I know there are many mistakes but I couldn't find some recent help, all the posts I see are old or not clearly documented ( or I'm stupid, if this option, show me the right way haha)










share|improve this question
























  • PS: I look at the couchdb documentation and understand what is saying but can't figure out how to code that idea

    – Daniel Saito
    Mar 21 at 18:46













2












2








2








I'm trying to create a system with couchdb@2.X and pouchdb@6.4.2, and I'm struggling to make the authentication code with db-per-user, I understood the general idea (kind of) and trying to search for an example or to fix my code, here is what I've did until now:



import Injectable from '@angular/core';
import PouchDB from 'pouchdb';
import PouchAuth from 'pouchdb-authentication';
import syncResult from './../../models/syncResult'
import credentials from '../../models/credentials';
PouchDB.plugin(PouchAuth);

/*
Generated class for the PouchDbServiceProvider provider.

See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class PouchDbServiceProvider {

url:any;
private localDB: any;
private remoteDB:any;
username: string;
password: string;
constructor(private pendingSync: Promise<syncResult>)



singUp(user,pass)
this.teardown();

let options =
live:true,
retry:true,
continuous:true,
auth:
username: user,
password: pass



this.localDB = new PouchDB(this.getDBname(user));
this.remoteDB = new PouchDB('http://localhost:5984/'+this.getDBname(user),options);
this.localDB.sync(this.remoteDB,options);


private getDBname(userIdentifier:string)
var dbName = userIdentifier.toLowerCase().replace(/[^a-z0-9_$()+-]/g, "-");
return (dbName);


public teardown()

if(!this.localDB)
return;

this.localDB.close();
this.localDB = null;
this.remoteDB.close();
this.remoteDB = null;



Above is the provider that deals (or had to) with the sync between local and remote. The error I have is next:



 Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[PouchDbServiceProvider -> t]: 
StaticInjectorError(Platform: core)[PouchDbServiceProvider -> t]:
NullInjectorError: No provider for t!
Error: StaticInjectorError(AppModule)[PouchDbServiceProvider -> t]:
StaticInjectorError(Platform: core)[PouchDbServiceProvider -> t]:
NullInjectorError: No provider for t!
at _NullInjector.get (http://localhost:8100/build/vendor.js:1377:19)
at resolveToken (http://localhost:8100/build/vendor.js:1675:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1485:20)
at resolveToken (http://localhost:8100/build/vendor.js:1675:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1485:20)
at resolveNgModuleDep (http://localhost:8100/build/vendor.js:11270:25)
at _createClass (http://localhost:8100/build/vendor.js:11307:29)
at _createProviderInstance$1 (http://localhost:8100/build/vendor.js:11281:26)
at c (http://localhost:8100/build/polyfills.js:3:19752)
at Object.reject (http://localhost:8100/build/polyfills.js:3:19174)
at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:51765:16)
at NavControllerBase._failed (http://localhost:8100/build/vendor.js:51758:14)
at http://localhost:8100/build/vendor.js:51805:59
at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
at Object.onInvoke (http://localhost:8100/build/vendor.js:5134:33)
at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
at r.run (http://localhost:8100/build/polyfills.js:3:10143)
at http://localhost:8100/build/polyfills.js:3:20242


I know there are many mistakes but I couldn't find some recent help, all the posts I see are old or not clearly documented ( or I'm stupid, if this option, show me the right way haha)










share|improve this question
















I'm trying to create a system with couchdb@2.X and pouchdb@6.4.2, and I'm struggling to make the authentication code with db-per-user, I understood the general idea (kind of) and trying to search for an example or to fix my code, here is what I've did until now:



import Injectable from '@angular/core';
import PouchDB from 'pouchdb';
import PouchAuth from 'pouchdb-authentication';
import syncResult from './../../models/syncResult'
import credentials from '../../models/credentials';
PouchDB.plugin(PouchAuth);

/*
Generated class for the PouchDbServiceProvider provider.

See https://angular.io/guide/dependency-injection for more info on providers
and Angular DI.
*/
@Injectable()
export class PouchDbServiceProvider {

url:any;
private localDB: any;
private remoteDB:any;
username: string;
password: string;
constructor(private pendingSync: Promise<syncResult>)



singUp(user,pass)
this.teardown();

let options =
live:true,
retry:true,
continuous:true,
auth:
username: user,
password: pass



this.localDB = new PouchDB(this.getDBname(user));
this.remoteDB = new PouchDB('http://localhost:5984/'+this.getDBname(user),options);
this.localDB.sync(this.remoteDB,options);


private getDBname(userIdentifier:string)
var dbName = userIdentifier.toLowerCase().replace(/[^a-z0-9_$()+-]/g, "-");
return (dbName);


public teardown()

if(!this.localDB)
return;

this.localDB.close();
this.localDB = null;
this.remoteDB.close();
this.remoteDB = null;



Above is the provider that deals (or had to) with the sync between local and remote. The error I have is next:



 Error: Uncaught (in promise): Error: StaticInjectorError(AppModule)[PouchDbServiceProvider -> t]: 
StaticInjectorError(Platform: core)[PouchDbServiceProvider -> t]:
NullInjectorError: No provider for t!
Error: StaticInjectorError(AppModule)[PouchDbServiceProvider -> t]:
StaticInjectorError(Platform: core)[PouchDbServiceProvider -> t]:
NullInjectorError: No provider for t!
at _NullInjector.get (http://localhost:8100/build/vendor.js:1377:19)
at resolveToken (http://localhost:8100/build/vendor.js:1675:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1485:20)
at resolveToken (http://localhost:8100/build/vendor.js:1675:24)
at tryResolveToken (http://localhost:8100/build/vendor.js:1617:16)
at StaticInjector.get (http://localhost:8100/build/vendor.js:1485:20)
at resolveNgModuleDep (http://localhost:8100/build/vendor.js:11270:25)
at _createClass (http://localhost:8100/build/vendor.js:11307:29)
at _createProviderInstance$1 (http://localhost:8100/build/vendor.js:11281:26)
at c (http://localhost:8100/build/polyfills.js:3:19752)
at Object.reject (http://localhost:8100/build/polyfills.js:3:19174)
at NavControllerBase._fireError (http://localhost:8100/build/vendor.js:51765:16)
at NavControllerBase._failed (http://localhost:8100/build/vendor.js:51758:14)
at http://localhost:8100/build/vendor.js:51805:59
at t.invoke (http://localhost:8100/build/polyfills.js:3:14976)
at Object.onInvoke (http://localhost:8100/build/vendor.js:5134:33)
at t.invoke (http://localhost:8100/build/polyfills.js:3:14916)
at r.run (http://localhost:8100/build/polyfills.js:3:10143)
at http://localhost:8100/build/polyfills.js:3:20242


I know there are many mistakes but I couldn't find some recent help, all the posts I see are old or not clearly documented ( or I'm stupid, if this option, show me the right way haha)







javascript angular ionic-framework couchdb pouchdb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 21 at 18:43







Daniel Saito

















asked Mar 21 at 18:03









Daniel SaitoDaniel Saito

112




112












  • PS: I look at the couchdb documentation and understand what is saying but can't figure out how to code that idea

    – Daniel Saito
    Mar 21 at 18:46

















  • PS: I look at the couchdb documentation and understand what is saying but can't figure out how to code that idea

    – Daniel Saito
    Mar 21 at 18:46
















PS: I look at the couchdb documentation and understand what is saying but can't figure out how to code that idea

– Daniel Saito
Mar 21 at 18:46





PS: I look at the couchdb documentation and understand what is saying but can't figure out how to code that idea

– Daniel Saito
Mar 21 at 18:46












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286640%2fcreating-a-pouchdb-authentication-with-couchdb%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55286640%2fcreating-a-pouchdb-authentication-with-couchdb%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript