cloudant / meteor-couchdb

Meteor database driver for CouchDB and Cloudant
Other
53 stars 7 forks source link

user accounts #8

Open ccorcos opened 9 years ago

ccorcos commented 9 years ago

It would be awesome to use account-base and accounts-password with CouchDb now too, entirely removing the mongo dependency!

praneybehl commented 9 years ago

:+1: for CouchDB supported accounts packages :+1:

mariobriggs commented 9 years ago

As the meteor folks are playing around with a sql backend as mentioned here - https://forums.meteor.com/t/apache-couchdb-support-released-in-atmosphere/8993/4 i think it is a good oppo to look at how the account modules can be neatly tweaked around to work with different backends. I havent yet looked at the accounts module and it might turn out that it is already designed that way, in which case great, but if not i think it will great to have the community users vote for such a feature

ccorcos commented 9 years ago

Well I'd love to integrate it with ccorcos:any-db and my neo4j driver so let me know if you're able to spearhead this project ;)

mariobriggs commented 9 years ago

looks like we are in luck - pushed https://github.com/mariobriggs/meteor-accounts-couchdb out just now. give it a try and let me know how goes

ccorcos commented 9 years ago

hmm. is there no api for this? it looks like you had to copy over most of the code :/

mariobriggs commented 9 years ago

The accounts-base and accounts-password packages in the meteor-accounts-couchdb repo are a duplicate copy of what is in the 'meteor/postgres-packages' repo. I made a copy of those only for ease of use for the end-user at this point in time - so that for someone wanting to use couchDB accounts, there is only one repo to clone (you dont have to clone 'meteor/postgres-packages' also to get a part).

The thinking is that ultimately the changes in 'meteor/postgres-packages' s accounts-base and accounts-password, (for pluggability of which backend repo to use,) will get back into core meteor's accounts-password/account-base. At that point the accounts-password-couchdb/accounts-base-couchdb can be released as independent packages.

For the api question - The api for the end-user doesnt change, it is the same Accounts.createUser , Meteor.loginWithPassword etc. In the sample app in the meteor-accounts-couchdb repo, i have just used the accounts-ui package which calls those default meteor api's, rather than the app calling them.

hopefully this clears up i.e. the api of accounts-password-couchdb/accounts-base-couchdb is invoked by accounts-password/accounts-base package and not end-user

ccorcos commented 9 years ago

I guess my point is, what if I want to use some other database entirely. Or what if I want to use accounts-facebook. Is it possible at this point to plug in to the accounts-base package without copying it over wholesale?

mariobriggs commented 9 years ago

use with accounts-facebook - The AccountsDBClientXXX interface/class has 2 method for this aspect (getUserByServiceIdAndName & setServiceData). So the answer is yes (however note that i have not tested that aspect and meteor postgres also doesnt claim to have tested, so might still have a few bugs)

plug-in without copying over - apart from a release of the modified accounts-base/password package by someone, not getting more brainy ideas :-)

praneybehl commented 9 years ago

Error when trying to add accounts-facebook package, I get the following error:

W20151103-17:20:17.901(11)? (STDERR) W20151103-17:20:17.902(11)? (STDERR) /Users/Manny/.meteor/packages/meteor-tool/.1.1.9.qxcaxm++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245 W20151103-17:20:17.902(11)? (STDERR) throw(ex); W20151103-17:20:17.902(11)? (STDERR) ^ W20151103-17:20:17.956(11)? (STDERR) Error: URL must be in the format mongodb://user:pass@host:port/dbname W20151103-17:20:17.957(11)? (STDERR) at Error () W20151103-17:20:17.957(11)? (STDERR) at exports.parse (/Users/Manny/.meteor/packages/npm-mongo/.1.4.39_1.1x363uo++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/connection/url_parser.js:15:11) W20151103-17:20:17.957(11)? (STDERR) at Function.MongoClient.connect (/Users/Manny/.meteor/packages/npm-mongo/.1.4.39_1.1x363uo++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/mongo_client.js:164:16) W20151103-17:20:17.957(11)? (STDERR) at Function.Db.connect (/Users/Manny/.meteor/packages/npm-mongo/.1.4.39_1.1x363uo++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongodb/db.js:2096:23) W20151103-17:20:17.957(11)? (STDERR) at new MongoConnection (packages/mongo/mongo_driver.js:173:1) W20151103-17:20:17.957(11)? (STDERR) at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:1) W20151103-17:20:17.957(11)? (STDERR) at Object. (packages/mongo/remote_collection_driver.js:38:1) W20151103-17:20:17.957(11)? (STDERR) at Object.defaultRemoteCollectionDriver (packages/underscore/underscore.js:750:1) W20151103-17:20:17.957(11)? (STDERR) at new Mongo.Collection (packages/mongo/collection.js:98:1) W20151103-17:20:17.958(11)? (STDERR) at ServiceConfiguration.configurations._ensureIndex.service (packages/service-configuration/service_configuration_common.js:8:1) => Exited with code: 8

mariobriggs commented 9 years ago

thanks. I guess i could use the LocalMarket app which uses the loginWithTwitter and would hit the same issue, or do u have a simpler sample/use-case to work with

praneybehl commented 9 years ago

Thanks for the quick reply, I am just trying out the https://github.com/mariobriggs/meteor-accounts-couchdb app I am building a new Meteor app and since its in initial stages I thought to give couchDb a go and see how it goes. Cheers!

praneybehl commented 9 years ago

Not sure why, but I am getting crazy slow response time with Cloudant. Just created an account and took it for a spin. I type the username and password and hit the login button and it takes anywhere between 15-23 secs to login.

praneybehl commented 9 years ago

Here is a screencast : image

mariobriggs commented 9 years ago

I have seen this slow response times on and off myself during dev with both Cloudant and PostgresSQL (was using a ElephantSQL service instance). Other times it has been fast enough, so the only conclusion i could come too was network slowness during some periods. I cross checked now and on my version, seems ok - http://simple-todos-mariobriggs-1938.mybluemix.net/

praneybehl commented 9 years ago

True, thanks for the input mate

Cheers!