How to sync existing 1M+ user database with Memberstack API for seamless SSO login? Answered
Hi memberstack team,
I wanted to know regarding your login API feature.
We have our DB in mongo & postgress, and have about 1M+ user base on mobile App.
now we are planning to integrate login feature in our webflow base website, Our webflow lead has suggested us using memberstack for this feature. wanted to know how Memberstack will be able to handle our data & maintain 100% sync in user journey between App & website.
Comments
6 comments
Mongo and Postgres are 2 diferente databases. I think you would need to provide a little more info on your architecture, and how the data is related to each other to better advice.
Memberstack acts as a micro-service, providing the whole functionality for authentication and authorization, and its own database for storing users data.
Assuming you already have a user database and want those users to communicate with Webflow, there are a few options you could implement.
More information about Memberstack API to ease with the integrations can be found here https://developers.memberstack.com/docs
Admin is a main backend package
Dom is the main frontend package
can we use our own DB ??
If you wanted to use Memberstack you will have to use their own DB. Import your members to MS and keep the two (MS and yours) databases in sync
Hi everyone! I'm currently on the basic plan and would like to know if API login is supported for my account? I'm looking to test if there's a way to implement single sign-on for an app I've created, allowing users to use their app credentials (which are the same as the credentials for the user in Memberstack) without having to log in again manually to Memberstack. Therefore, I need access to the API login to proceed with this.
Would I need additional CORS setup on Memberstack’s side for Memberstack's login requests?
I’m still working on getting users to log in automatically through my system, but I believe I need a token to do so. Is there a specific token I should be looking for to check if a user is logged in?
My goal is to enable an automatic login in my system so that when a user clicks a "Help" button in my app, they are taken directly to Memberstack (where there will be a help page) without needing to manually log in. Could you clarify how I can retrieve and use the correct token for this?
Also, if API login is not available for the basic plan, do I need an upgrade to allow backend authentication?
Any help would be appreciated! Thank you!
Hello Ana,
In Memberstack, the only way to login using the API is by using the frontend API https://developers.memberstack.com/docs/dom-front-end-package#signing-up-a-member-using-email-and-password
If the frontend package doesn’t work for your needs (e.g., because you're handling credentials on your backend), you can inspect Memberstack’s login request and send the credentials using your own service.
Memberstack has two APIs or packages, the frontend called DOM package and the backend called Admin package. API login is only available using the frontend API package. So the login is always using the frontend. You can analyze the rest requests it does under the hood and adapt it to force a login in using your system.
Using the admin package is not possible to login. Only to manage users.
I don’t think you’ll need CORS setup to login.
Upgrading Memberstack tiers would only allow you to have more users. They don’t limit their features per plan. All main features are available for all users. Except for the unlimited trial users that can only have test members. If you are already paying you already have all the features.
Memberstack only supports logging in with email/password, email/code (passwordless), or social logins from their approved list. They don’t allow custom SSO providers, so if you need to log users in with credentials stored in your own database, you’ll have to create a workaround.
To do this, you’ll need to build a wrapper around Memberstack’s library that matches the credentials it expects. Basically, you should keep almost a mirror of your member base and memberstack base, so when accesing a memberstack page you send the stored credentials to automatically log them in. Before implementing anything, it’s important to think through the architecture. You might come up with your own solution. That’s why I recommend inspecting how Memberstack processes their requests.
You can do this by:
When you log in or sign up a user, Memberstack sends the credentials to its servers and returns a token. You can store this token in your database to keep the session active until it expires. I attached an example of a signup request. I got the parameters by inspecting Memberstack API and send it as a REST request. At the bottom of the request theres the token object.
This is not a typical scenario, I'm basically giving you an idea on how to do it... but you wont find much support out there since this basically involves building a custom adapter of a service. Also, something to keep in mind: they could update their API without notice, potentially introducing breaking changes (highly unlikely, but it can happen). It's a risk you must take into consideration for any future issues that might arise.
If you ask me, I would have to have a really good reason to use Memberstack if I already have a member database and authorization provider to duplicate my database with an external provider, and also create another service to interact with it... In programming, almost anything is possible, but sometimes it might be not worth it.
Hi Raquel,
Thank you for clarifying that for me!
I am actually using my Memberstack credentials so I'm not signing up a new user, I'm logging in an existing user. What would be the API for logging in an existing user?
I'm able to see in console of my app that I'm logging in the user as I have the credentials stored in the local storage. I've also tried storing it in cookies. After logging, I try to redirect to the dashboard page but it keeps taking me back to the log in page still, are there more authorizations that are happening in Memberstack after logging in? Or will just a REST request solve the problem for all authorizations?
Any help would be appreciated! Just to clarify some things. I'd really appreciate it!
Please sign in to leave a comment.