Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Using same credentials, in CRM and storefront does not work correctly #10049

Open
Furman1331 opened this issue Nov 12, 2024 · 0 comments

Comments

@Furman1331
Copy link
Contributor

Furman1331 commented Nov 12, 2024

Package.json file

{
  "name": "medusa-next",
  "version": "1.0.3",
  "private": true,
  "author": "Kasper Fabricius Kristensen & Victor Gerbrands (https://www.medusajs.com)",
  "description": "Next.js Starter to be used with Medusa server",
  "keywords": [
    "medusa-storefront"
  ],
  "scripts": {
    "dev": "next dev -p 8000",
    "build": "next build",
    "start": "next start -p 8000",
    "lint": "next lint",
    "analyze": "ANALYZE=true next build",
    "test-e2e": "playwright test e2e"
  },
  "dependencies": {
    "@headlessui/react": "^1.6.1",
    "@hookform/error-message": "^2.0.0",
    "@medusajs/js-sdk": "2.0.0",
    "@medusajs/ui": "2.0.0",
    "@meilisearch/instant-meilisearch": "^0.7.1",
    "@paypal/paypal-js": "^5.0.6",
    "@paypal/react-paypal-js": "^7.8.1",
    "@stripe/react-stripe-js": "^1.7.2",
    "@stripe/stripe-js": "^1.29.0",
    "algoliasearch": "^4.20.0",
    "axios": "^1.6.7",
    "i18next": "^23.16.4",
    "jwt-decode": "^4.0.0",
    "lodash": "^4.17.21",
    "next": "^14.0.0",
    "pg": "^8.11.3",
    "qs": "^6.12.1",
    "react": "^18.2.0",
    "react-country-flag": "^3.0.2",
    "react-dom": "^18.2.0",
    "react-instantsearch-hooks-web": "^6.29.0",
    "react-intersection-observer": "^9.3.4",
    "server-only": "^0.0.1",
    "superagent": "^10.1.1",
    "tailwindcss-radix": "^2.8.0",
    "webpack": "^5"
  },
  "devDependencies": {
    "@babel/core": "^7.17.5",
    "@medusajs/types": "2.0.0",
    "@medusajs/ui-preset": "2.0.0",
    "@playwright/test": "^1.41.1",
    "@types/lodash": "^4.14.195",
    "@types/node": "17.0.21",
    "@types/pg": "^8.11.0",
    "@types/react": "^18.2.42",
    "@types/react-dom": "^18.2.18",
    "@types/react-instantsearch-dom": "^6.12.3",
    "@types/superagent": "^8.1.9",
    "ansi-colors": "^4.1.3",
    "autoprefixer": "^10.4.2",
    "babel-loader": "^8.2.3",
    "eslint": "8.10.0",
    "eslint-config-next": "^13.4.5",
    "postcss": "^8.4.8",
    "prettier": "^2.8.8",
    "tailwindcss": "^3.0.23",
    "typescript": "^5.3.2"
  },
  "packageManager": "[email protected]"
}

Node.js version

v20.5.1

Database and its version

PostgresSQL 16.2

Operating system name and version

MacOS Sequoia 15.0.1

Browser name

Brave

What happended?

While login with my credentials to CRM. I've got correct response, but while trying to login with same credentials at storefront, in response I've got 200 with jwt in cookies which is incorect behavior. This JWT token wont allow me to open /account/dashboard, because it should not be generated, it happens because user and customer use same fields in database without any difference.

You probably need to change the logic in the auth routes, as you currently only recognise which provider you should use.

Expected behavior

Separate authentication logic based on which type of user is trying to authenticate.

Actual behavior

Logic connects customer and user, but does not work corectlly.

Link to reproduction repo

Medusa Starter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants