daniccan / multi-tenant-node-app Goto Github PK
View Code? Open in Web Editor NEWPOC of Multi-Tenant REST Application Built on top of NodeJS
POC of Multi-Tenant REST Application Built on top of NodeJS
after extracting I had tried to install packages through npm install but the errors are coming
I was able to POST the initial signup:
curl -X POST -H "Content-Type: application/json" -d @signup.json http://localhost:3000/api/v1/accounts/signup
the user was created in my tenant_1
database User table and the Account table was populated - cool
but when I try to extract the user:
curl -X POST -H "Content-Type: application/json" -H "X-TENANT-ID: 1" -d @login.json http://localhost:3000/api/v1/auth/login
I get: {"message":"Invalid email or password.","user":false}
The other curl commands give me unauthorized
. Even though I have a valid JWT token. I think it's a valid JWT token. I created a secret key and put it in passport.js
. Then generated a JWT token from it at https://jwt.io
. (is that correct?)
Maybe if you could post some sample curl commands that work for you it would be helpful.
Btw: I'm using Postgres dialect in Sequelize.
Cheers, Dave
Hello,
Currently the associate() method for Account is not implemented and I wanted to understand how it's related to other models. Is there one Account instance for every user? It would help me if you can describe the purpose of the Account class.
thanks,
Vineet
I've successfully generated a token and I'm now trying to POST to /api/v1/organizations with the following:
curl -X POST -H "Authorization:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZmlyc3ROYW1lIjoiSm9obiIsImxhc3ROYW1lIjoiRG9lIiwiZW1haWwiOiJqb2huZG9lQGFscGhhYmV0LmNvbSIsImlzU3VwZXJBZG1pbiI6dHJ1ZSwiY3JlYXRlZEF0IjoiMjAyMy0wNS0yM1QxNjozODoyOC4xNjlaIiwidXBkYXRlZEF0IjoiMjAyMy0wNS0yM1QxNjozODoyOC4xNjlaIiwib3JnYW5pemF0aW9uSWQiOm51bGwsImlhdCI6MTY4NDg2MDEyM30.r4pptURJrMp0sigOM0HCF_kKi4NWjrV_BWB1tOV2Ju0" -H "Content-Type: application/json" -d @org.json http://localhost:3000/api/v1/organizations
I always get a 401 Unauthorized
message. The JWT has been verified at jwt.io
.
When attempting to login from postman, it returns a 400 error code with msg "Login Failed". Checking the database I noticed that signup didn't generate and consequently save the user on its corresponding "Users" table even though the call for the user creation is there inside the signup data provider that gets executed when performing a signup from postman.
What's interesting is that the promise for the "userDataProvider.createUser" doesn't return a reject as one would expect. Also I noticed that the User model has a foregin key dependency to an organization id. And based on the code the payload object for the user isn't receiving it.
UPDATE: I was able to filter out the error. It seems the query field for "organizationId" is somehow changed to start with capital O as described here. Also I manually created this user by inserting it directly into the database so that's the reason I'm trying to use this data.
I will keep trying to debug this issue in the hopes of finding a proper fix for it. Also If I'm missing anything let me know. Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.