daniccan / multi-tenant-node-app

POC of Multi-Tenant REST Application Built on top of NodeJS
39 stars 16 forks source link

Example Curl Calls #21

Closed kubeworkz closed 1 year ago

kubeworkz commented 1 year ago

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

kubeworkz commented 1 year ago

Figured it out.