Code Monkey home page Code Monkey logo

multi-tenant-node-app's Introduction

Hi there ๐Ÿ‘‹

multi-tenant-node-app's People

Contributors

daniccan avatar dependabot[bot] avatar mccp-dssc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

multi-tenant-node-app's Issues

Example Curl Calls

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

Account vs User

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

401 Unauthorized Posting to Organizations

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.

Login Fails because Signup didn't create any user.

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.

image

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.
image

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.