Creating new user in Cloudant and Angularjs - angularjs

As I'm moving from CouchDB to Cloudant and since there is no _users database in Cloudant what are the best practices of creating a new user using POST/PouchDB authentication and updating user document with some data eg. login time?

It is possible to use CouchDB style users with Cloudant databases, see Enabling the _users database with Cloudant section of the authorization docs. However there are also solutions such as envoy which can help out.

Related

How to Create Individual YouTube API Keys for Users in a React Website

I have a website that uses the YouTube API, and I am looking for a solution to generate unique API keys for each individual user upon login, so as to prevent multiple users from utilizing a single key. Is there a feasible way to achieve this, or is there a more effective approach to consider?
I am not sure how to approach this issue as I do not have enough information or context about the problem.
Creating additional api keys is not the solution to your issue.
Each application you create should have two projects on google cloud console.
Development
Production
You should then create a single api key used by your application, and Oauth2 client credentials if you need them.
If you run out of quota you should simply fill out the YouTube API Services - Audit and Quota Extension Form and request additional quota.

exporting data for analytics use in SaaS

We are a SaaS product and we would like to be able have per-user data exports that will be used with various analytical (BI) tools like Tableau or PowerBI. Instead of just managing all those exports manually, we thought of using some cloud database such as AWS Redshift (which will be part of our service). But then, it is not clear how is user will access those databases naturally, unless we do some kind of SSO integration with AWS.
So - what is the best practice for exporting data for analytics use in SaaS products?
In this case you can build your security in to your backend API layer.
First you can set up processes to load your data to Redshift, then make sure that only your backend API server/cluster has access to redshift (e.g. through a vpc with no external ip access to redshift)
Now you have your data, you can validate your user as usual through your backend service, then when a user requests a download through the backend API, the backend can create a query to extract from redshift only the correct data based upon the users security role. In order to make this possible you may need to build some kind of security column into your redshift data model.
I am assuming getting data to redshift is not a problem.
What you are looking for, if I understand correctly is a OEM solutions.
The problem is how does one mimic the security model you have in place for your SaaS offering.
That depends on how complex is your security model.
If it is as simple as just authenticate the user and he has access to all tenant data or the data can be easily filtered for user. Things are simple for you. Trusted authentication will allow you to authenticate that user and user filtering will allow you to show him all that he has access to.
But here is the kicker, if your security is really complex , then it can become really difficult to mimic it within these products.
Here for integrating tableau this link will help:-
https://tableau.github.io/embedding-playbook/#
Power BI, this product am not a fan off. I tried to embed a view in one my applications and data refresh was a big issue.
Its almost like they want you to be a azure shop for real time reporting.( I like GCP more )
If you create the api's and populate datasets then they have crazy restrictions like 1MB/sec etc.
On the other instances datasets can be refreshed only 8 times.
I gave up on them.
Very recently I got a call from Sisense and they seemed promising as well from a OEM perspective. You might was to try them.

How to migrate mongdb users using Passportjs to Couchdb?

I'm building an offline-first app but didn't research on it until now. My current setup is the app uses Angular(1.x) and communicates to my server using NodeJS on a MongoDB Database. I'm using PassportJS for my authentication at the moment.
I'd like to migrate all my date to CouchDB and use PouchDB on my app.
How do I migrate from my current setup to PouchDB to CouchDB?
How can I authenticate my users after migration?
How do I migrate my current setup to CouchDB
Moving data
To export/import data from mongo to couch, you can simply follow these steps. Basically, you just dump your jsons and push them in Couch.
Structuring data
In CouchDB, there's no collections. Usually, to split your data into "collections", you simply add a special key to identify the collection. It can be type or collection for example.
Permissions
I'm not aware of the permissions system in MongoDB but basically, you can only define permissions at database level. So if you want some people to access certain documents, you can either use an application layer to handle permissions or you can split your documents with the per-user-pattern(One database per user and one global database without all public data).
Authentification
You can still use passportjs with CouchDB(see this example).
Also, you can use CouchDB authentification system which is builtin. Therefore, it has some limitations(eg: you can't expire someone's token and there's not builtin password recovery system).

IBM Bluemix Mobile Data Services, Loading data into the cloud

I want to create an android application, I want my application data to be persistent. There is a file that I want to save every time to the Bluemix server.
I want to confirm the following, for a situation in which a user "A" from my application saves the data to the IBM Bluemix Server, and if there are more than 2000 users saving the same user-related file in the server:
Will there be any differences between all the different user files?
Will there be any collisions?
Will I be able to differentiate the
files of other users?
Will I be able to save and retrieve the saved
file of only that particular user?
Thank you.
Using the Mobile Client Access (MCA) service you will be able to do exactly what you ask.
MCA can provide you with a unique identifier for each authenticated Facebook, Google+, or custom style user, enabling you to manage your data appropriately. I recommend the Cloudant NoSQL DB service for fast and easy database management.
See the MCA docs and Android sample for further information.

Best practice for a multiuser CouchDB-based app?

I create a CMS from scratch and decided to use CouchDB as my database solution. For my CMS I need various accounts and of course different user roles (admin, author, unregistered user, etc.).
First I thought I would program authorization within my CMS myself, but CouchDB has stuff like this build in, so I want to ask:
What is the best practice creating a multiuser app with CouchDB?
Create only one admin for CouchDB and manage restrictions, roles and accounts by yourself?
Use build-in functionality of CouchDB for all this? (Say create a CouchDB admin user for every admin of the CMS?)
What if I want to add other 3rd-party authorization later? Say I want users to login via Twitter/Facebook/Google?
Greetings,
Pipo
The critical question is whether you want to expose CouchDB to the public or not.
If you want to build your CMS as a classical 3-tier architecture where CouchDB is exclusively accessed from a privileged scripting layer, e.g. PHP, then I would recommend you to roll your own authorization system. This will give you better control over the authorization logic. Particularly, you can realize document based read access control (not available in the CouchDB security system).
If instead you want to expose CouchDB to the public, things are different. You cannot actually write server side logic (except for separate asynchronous listeners via the changes feed) so you will have to use CouchDB's built in authentication/authorization system. That limits you to read access controlled on a database level (not document level!). Write access can be controlled with validation functions. CouchDB admins should not be equivalent to application admins as a CouchDB admin is rather comparable to a server admin in a traditional setting. A database admin in CouchDB would be a better fit (can change design documents and therefore make modifications to the CMS installation like adding plugins). All other users with write access can be realized as database members.
I would prefer the second approach, because this will give you the possibility to leverage all the nice features of CouchDB like replication and the changes feed. However, you will have to do some filtered replication between databases with different members if you need fine grained read access control.
If you want to use other authentication mechanisms than those offered by CouchDB, you will eventually have to modify the installation (which can be an issue if you want to use a hosted CouchDB). For a facebook plugin see e.g. https://github.com/ocastalabs/CouchDB-Facebook-Authentication.

Resources