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

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?