Git Product home page Git Product logo

medusa-plugins's Introduction

Medusa-plugins logo

medusa-plugins

Contributors Awesome medusajs Discord Activity Issues Licence Contributing sponsor

A collection of awesome plugins for medusa 🚀


Documentation

Medusa plugins documentation

-----------------------------------------------------

Introduction

Let's build together an awesome collection of plugins for medusajs. Do not hesitate to use, open pr or contribute in any way 🔥

-----------------------------------------------------

Plugins

Name Target Badges
medusa-plugin-sentry medusa NPM Version Tests pipeline
medusa-plugin-sentry-ui medusa NPM Version
medusa-plugin-prometheus medusa NPM Version Tests pipeline
medusa-plugin-auth medusa NPM Version Tests pipeline

-----------------------------------------------------

Contribute

Contributions are welcome! You can look at the contribution guidelines

-----------------------------------------------------

Like my work? 💓

This project needs a ⭐ from you. If you really like our projects, do not hesitate to back us sponsor

medusa-plugins's People

Contributors

abmenzel avatar adrien2p avatar andrei-madalin-vlad avatar dependabot[bot] avatar dfrnoch avatar dpreininger avatar edihasaj avatar f-wilke avatar fazers avatar goring avatar juanzgc avatar letalumil avatar luluhoc avatar mortenengel avatar sgfgov avatar sl1mpshady avatar stephane-segning avatar tsvetann avatar tulski avatar zeelrupapara 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  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  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  avatar  avatar  avatar  avatar  avatar

medusa-plugins's Issues

Using the plugin gives 401 on profile querying for customer /store/auth

The login / signup workflow works like a charm, great job for you on this 😁👌. But I don't get it why it returns 401 after I successfully login/signup with e.x. Google, the cookies are being with the request but I just get 401. If I disable the plugin everything works as expected.

this is for medusa-plugin-auth

Can't add google auth

@adrien2p
I did the same as mentioned on medusa-plugin-auth documentation to add google auth to medusa application.
But got some error. Tell me if I'm missing something here

Error:

image image

This is my Google Client

image

Unauthorized after updating to 1.8.2

Hi, i updated to the latest version.
But when i go to the endpoint /store/auth/ to get the current customer object.
It returns 401 Unauthorized.

The user is successfully created and returns the cookie credentials when using the firebase auth. But the returned cookie is not valid for use in any store endpoints.

Best regards.

Error: Admin with email *** already exists

I've just added the auth plugin with the default config for Auth0 shown in the documentation.

This is my user table:

id email first_name last_name api_token created_at updated_at deleted_at metadata role vendor_id
usr_01GQ82V74ZW9RXDQN2TPN7EJQD [email protected] null null null 2023-01-20 17:15:28.031860 +00:00 2023-01-20 17:15:55.377591 +00:00 null null admin null
usr_01GQ82W1XEVFX8W0PVV8E0TZKT [email protected] null null null 2023-01-20 17:15:55.682478 +00:00 2023-01-20 17:15:55.682478 +00:00 null null member vendor_01GQ82W1T7GK1ZE102AWGM05D1
usr_01GQ82W1XTEH4XT5HPE2EW5Y22 [email protected] null null null 2023-01-20 17:15:55.700832 +00:00 2023-01-20 17:15:55.700832 +00:00 null null member vendor_01GQ82W1TFEJWAKH3ZYT55SQD1

I've created an user in Auth0 with the email [email protected].
image

After signing in through Auth0 form, I get redirected to the admin callback (/admin/auth/auth0/cb) and the following error is displayed:

Error: Admin with email [email protected] already exists
    at validateAdminCallback (E:\Work\Clevertech\Foraged\Repos\foraged-v3\backend\node_modules\medusa-plugin-auth\src\core\validate-callback.ts:37:10)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Auth0AdminStrategy.validate (E:\Work\Clevertech\Foraged\Repos\foraged-v3\backend\node_modules\medusa-plugin-auth\src\auth-strategies\auth0\admin.ts:47:23)
    at async callback (E:\Work\Clevertech\Foraged\Repos\foraged-v3\backend\node_modules\medusa-plugin-auth\src\core\passport\Strategy.ts:19:29)

The documentation says the default behaviour is as follows:

  • for the admin
    • if the user trying to authenticate exists
      then we are looking in the metadata to find if any other external authentication methods have been used. If none are found, then the user gets authenticated and can proceed and the metadata gets updated. In the case another external authentication method have been used in the past, then an unauthorized will be returned. If you want to allow a user to use multiple external authentication methods, you can update his metadata
    • if the user trying to authenticate does not exist, an unauthorized error will be returned

The metadata column for this user is null and it's not clear what the plugin is expecting here...

"If you want to allow a user to use multiple external authentication methods, you can update his metadata" .- How?

For reference, we're looking to exclusively use Auth0 for signing so we don't need to support Medusa's default authentication as well. So if all users and customers will be signing in through Auth0, what do we need to set in the metadata column for it to work?

Feature: Function-like options

  • Make options function-like, to help for multi-tenancy
  • Add providers by ID & type
  • Default provider ID is the type
  • Make options take an array

Auth0: verifyCallback executed during startup and not after signing in

I've implemented the plugin as described in the documentation.

{
    resolve: "medusa-plugin-auth",
    options: {
      auth0: {
        clientID: Auth0ClientId,
        clientSecret: Auth0ClientSecret,
        auth0Domain: Auth0Domain,

        admin: {
          callbackUrl: `${BACKEND_URL}/admin/auth/auth0/cb`,
          failureRedirect: `${ADMIN_URL}/login`,
          successRedirect: `${ADMIN_URL}/`,
          // authPath: '/admin/auth/auth0',
          // authCallbackPath: '/admin/auth/auth0/cb',
          // expiresIn: 24 * 60 * 60 * 1000,
          verifyCallback: (container, req, accessToken, refreshToken, extraParams, profile) => {
            // implement your custom verify callback here if you need it
            debugger;
            console.log(container, req, accessToken, refreshToken, extraParams, profile)
          }
        },

        store: {
          callbackUrl: `${BACKEND_URL}/store/auth/auth0/cb`,
          failureRedirect: `${STORE_URL}/login`,
          successRedirect: `${STORE_URL}/`,
          // authPath: '/store/auth/auth0',
          // authCallbackPath: '/store/auth/auth0/cb',
          // expiresIn: 24 * 60 * 60 * 1000,
          // verifyCallback: (container, req, accessToken, refreshToken, extraParams, profile) => {
          //    // implement your custom verify callback here if you need it
          // }
        }
      }
    }
  }

When I start the backend server, the verifyCallback is executed (why? all arguments are undefined). But then, when I go to http://localhost:9000/admin/auth/auth0, I get redirected to Auth0 as expected, then after signing in, I get the following error (this is expected as the default behaviour as there is no user with that email, but that's why I want to modify the callback to change this):

Error: Unable to authenticate the user with the email ***********************
    at validateAdminCallback (E:\Work\Clevertech\Foraged\Repos\foraged-v3\backend\node_modules\medusa-plugin-auth\src\core\validate-callback.ts:40:9)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Auth0AdminStrategy.validate (E:\Work\Clevertech\Foraged\Repos\foraged-v3\backend\node_modules\medusa-plugin-auth\src\auth-strategies\auth0\admin.ts:47:23)
    at async callback (E:\Work\Clevertech\Foraged\Repos\foraged-v3\backend\node_modules\medusa-plugin-auth\src\core\passport\Strategy.ts:19:29)

verifyCallback never seems to be executed during the flow.

Using @medusajs/medusa 1.7.5 and medusa-plugin-auth 1.3.1.


Also, by using this plugin with Auth0, we still need to have a row in the user table? If so, how does the plugin maps this? Just by email address? What about password_hash? Will that simply be ignored when using this plugin?
We're trying to achieve signup/signup through Auth0 only. No plain email/password credentials allowed.

Steam login - feature

Hi, I'm working on a digital products store using Medusa.
I'd like to add Steam login/signup.
I've seen there is node-steam-openid, and I was thinking of integrating this on this plugin. But honestly, I don't have the necessary knowledge yet.
I think it's not difficult to do, is it possible to add it as a feature here?
EDIT: there also is passport-steam, which makes it very easy considering current implementation of the others, like facebook.

I know it's pretty niche, so, if it's not possible, what's the general approach I should use to do it myself?
I know how to install and set up plugins regularly, but I don't know how to do that for a plugin of which I have the source code in my disk, and I'd like tinkering with.

Thanks in advance.

Google OAuth is not working for existing user(created using email/password-flow) try to login

Error:
"GET /store/auth/google/cb?code=*********************************&scope=email+profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+openid&authuser=0&prompt=none HTTP/1.1" 500 148 "-" "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Mobile Safari/537.36"
TokenError: Bad Request
at OAuth2Strategy.parseErrorResponse (/app/medusa/node_modules/passport-oauth2/lib/strategy.js:373:12)
at OAuth2Strategy._createOAuthError (/app/medusa/node_modules/passport-oauth2/lib/strategy.js:420:16)
at /app/medusa/node_modules/passport-oauth2/lib/strategy.js:177:45
at /app/medusa/node_modules/oauth/lib/oauth2.js:191:18
at passBackControl (/app/medusa/node_modules/oauth/lib/oauth2.js:132:9)
at IncomingMessage. (/app/medusa/node_modules/oauth/lib/oauth2.js:157:7)
at IncomingMessage.emit (node:events:523:35)
at IncomingMessage.emit (node:domain:489:12)
at endReadableNT (node:internal/streams/readable:1367:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
$ ^C
$ ^C

Users are not logged out of Auth0 when logging out through medusa

I noticed that after logging out from Medusa and logging back in through Auth0, users are returned to an OTP prompt (if using MFA) instead of having to specify email + password.

It seems that users are not logged out of auth0.
I think we would have to implement this step: https://auth0.com/docs/authenticate/login/logout/log-users-out-of-auth0#logout_hint
Or maybe I am missing something?

I would like to have a go at creating a PR for this, but I would love some feedback on how to approach it @adrien2p

strict config doesn't seem to work with 1.8.1

After upgrading to [email protected] the strict config is not working at more. I have strict=none in my app and I still got the message=Guest customer with email already exists. Has anything changed regarding strict config in the latest version?

Here is how I use it:

{
    resolve: "medusa-plugin-auth",
    /** @type {import('medusa-plugin-auth').AuthOptions} */
    options: {
      strict: "none",
      google: {

Thanks

Feedback for “Index”

Hi,
firstly, thank you for the auth plugin. I have an issue with it I hope you came across.
When enabled, normal auth (user/pass) does not work any longer. only Social auth is working (google/facebook).
if I disable the plugin, normal login works.
I am sure I am missing something, I hope you can help.

CORS issue but the rest of Medusa backend works

Hi,
I am facing an issue with plugin when moving from local development to a Railway server. I am using the plugin for authenticating admin users with Firebase. The plugin works as expected in my local environment but now when I have deployed my site and Medusa backend to Railway I receive this error:

❌ "Access to XMLHttpRequest at 'https://.up.railway.app/admin/auth/firebase' from origin 'https://.up.railway.app' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."

And got a "Referrer Policy: strict-origin-when-cross-origin" when inspected the network request.

I have added these environment variables in Railway:
BACKEND_URL=https://.up.railway.app
ADMIN_URL=https://.up.railway.app
STORE_URL=https://.up.railway.app

I've also tried to add https://.up.railway.app and https://.up.railway.app to the Authorised Domains in Firebase Authentication with no success.

The rest of Medusa works fine with no CORS issues.

Facebook login emailVerified false

I've setup both google and facebook login with the auth plugin, however I observed that upon customer creation, for facebook the metadata is {"authProvider": "facebook.store.medusa-auth-plugin", "emailVerified": false, "useSocialAuth": true}

For google it's {"authProvider": "google.store.medusa-auth-plugin", "emailVerified": true, "useSocialAuth": true}

What leads to the difference in emailVerified? Both of them actually have access to the email address.

how to handle strict mode?

Thanks for this plugin! The default behaviour of the plugin works well so far and as part of the design if a user has already registered with email + pass this plugin does not allow login with social media. If I understand correctly I can change the behaviour with strict mode? Is there any guidance or example how to do that? Thanks

How to manage failureRedirect when there is no login page

Hi and thanks for this library. I am a bit unsure how to configure failureRedirect config (medusa-plugin-auth with google), when I don't really have a login page. On my website the login functionality comes as a pop-up available on every page. How would you advise me to configure failureRedirect?

Thanks

Keycloak Auth Method

Hello, nice plugin guys. I want to use it for my next project. But I cannot, because a client want to integrate with his Keycloak SSO. Hence I'm re-openning this again, as I see the previous one (#65) was closed. I can work on that and can implement that feature. I just need to understand why the previous one wasn't approved

Firebase Auth - Unauthorized

Hi,

I am using the Firebase Auth Method for the store auth but when i try to auth from the store i'm getting the response "Unauthorized" I'm passing my accessToken from the auth.currentUser.getIdToken() method in the Authorization header.

I've generated the firebase credentials Json from the "service accounts" tab in firebase console.

My medusa config looks like this.

{ resolve: "medusa-plugin-auth", /** @type {import('medusa-plugin-auth').AuthOptions} */ options: { strict: "store", firebase: { credentialJsonPath: CredentialJsonPath, store: { authPath: "/store/auth/firebase", expiresIn: 24 * 60 * 60 * 1000, }, }, }, },

I've tried with the absolute path or relative path to the firebase credentials file.

Best regards
Hampus

"Customer already exists" error not handled gracefully

Hey! Thanks for this great and convenient plugin!

I stumbled upon one problem which is a bug. The steps to reproduce are:

  1. Set up at least 2 different providers - in my case, those are Google and Facebook
  2. You need to have an account for each provider with the same email. In my case, my Google & Facebook account both use my email [email protected].
  3. Create an account using store endpoint using the first provider - Facebook
  4. Sign out and try to create another account using the second provider - Google
  5. Error is thrown in the store endpoint but, it doesn't use failure redirect. It just throws an error directly into the browser.
image

Package versions

"@medusajs/medusa": "1.16.1",
"medusa-plugin-auth": "^1.6.0",

Error: Medusa Sentry Integration Throwing error

Plugin sentry was added. When I first tried to run it, it failed.

Error Message:

D:\medusa-framework-server-api\medusa-config.js:71
new Sentry.Integrations.Http({ tracing: true })
^

TypeError: Cannot read properties of undefined (reading 'Integrations')
at Object.integrations (D:\medusa-framework-server-api\medusa-config.js:71:22)
at resolveConfigProperties (D:\medusa-framework-server-api\node_modules\medusa-extender\dist\core\utils.js:87:42)
at resolveConfigProperties (D:\medusa-framework-server-api\node_modules\medusa-extender\dist\core\utils.js:84:23)
at resolveConfigProperties (D:\medusa-framework-server-api\node_modules\medusa-extender\dist\core\utils.js:84:23)
at resolveConfigProperties (D:\medusa-framework-server-api\node_modules\medusa-extender\dist\core\utils.js:84:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async asyncLoadConfig (D:\medusa-framework-server-api\node_modules\medusa-extender\dist\core\utils.js:92:26)
at async Medusa.load (D:\medusa-framework-server-api\node_modules\medusa-extender\dist\Medusa.js:40:30)
at async bootstrap (D:\medusa-framework-server-api\dist\main.js:11:5)

Node.js v18.12.1
[nodemon] app crashed - waiting for file changes before starting...

Sentry plugin not sending any data

"@medusajs/medusa": "1.7.5"
"medusa-extender": "1.8.8",
"medusa-plugin-sentry": "^1.4.0"

medusa-config.js has the following inside the plugins array.

{
    resolve: `medusa-plugin-sentry`,
    options: {
      dsn: process.env.SENTRY_DSN || "",
      // apiToken: SentryApiToken,
      integrations: (router, Sentry, Tracing) => {
        return [
          new Sentry.Integrations.Http({ tracing: true }),
          new Tracing.Integrations.Express({ router }),
        ]
      },
      tracesSampleRate: 1.0,
      // webHookOptions: {
      //   path: "/sentry/webhook",
      //   secret: "__YOUR_SECRET__",
      //   emitOnIssue: true,
      //   emitOnError: false,
      //   emitOnComment: true,
      //   emitOnEventOrMetricAlert: true,
      //   emitOnInstallOrDeleted: false,
      // }
    },
  },

SENTRY_DSN is indeed set.

I'm not getting any data in Sentry. No issues, no performance, no tracing.

How can I troubleshoot this better?

UPDATE
I've added debug: true to Sentry options and I'm getting the following logs...

Sentry Logger [log]: [Tracing] starting http.server transaction - GET /store/products
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (9c6e84654379ba22).
::1 - - [14/Feb/2023:15:33:36 +0000] "GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor HTTP/1.1" 200 10312 "-" "axios/0.24.0"
Sentry Logger [log]: [Tracing] Finishing http.server transaction: GET /store/products?limit=12&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor. 
Sentry Logger [log]: [Tracing] starting http.server transaction - GET /store/products
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (b3c95efa08b320ee).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (b3c95efa08b320ee).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (b3c95efa08b320ee).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (b3c95efa08b320ee).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (b3c95efa08b320ee).
Sentry Logger [log]: [Tracing] Starting 'db' span on transaction 'GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (b3c95efa08b320ee).
1GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (b3c95efa08b320ee).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (b3c95efa08b320ee).
Sentry Logger [log]: [Tracing] Finishing 'db' span on transaction 'GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor' (b3c95efa08b320ee).
::1 - - [14/Feb/2023:15:33:38 +0000] "GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor HTTP/1.1" 200 10592 "http://localhost:3000/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36"
Sentry Logger [log]: [Tracing] Finishing http.server transaction: GET /store/products?limit=12&cart_id=cart_01GS60XDMC1HSEGBG8MH8CRYJB&order=created_at&expand=tags%2Ctype%2Cimages%2Coptions%2Coptions.values%2Cvariants%2Cvariants.options%2Ccollection%2Cvendor.

So it looks like the plugins is working? No idea why I'm not seeing anything on Sentry...

Adding Google Authentication to the store: Am I missing something?

  • Hi , implementing a google Authentication is a new thing for me, so, here all the steps I went through to implement an authentication for the store

    1. Installing the plugin with yarn add medusa-plugin-auth.

    2. Setting the variables

        - const BACKEND_URL = process.env.BACKEND_URL || "localhost:9000";
        - const STORE_URL = "https:://localhost:8000";  I set this to localhost:8000 as I am testing the authentication on the local store.
        - const GoogleClientId = process.env.GOOGLE_CLIENT_ID || "";  
        - const GoogleClientSecret = process.env.GOOGLE_CLIENT_SECRET || "";  
        ```
        
        
    4. Setting the configuration as it's written in the documentation
        ```
         options: [
      {
        type: "google",
        // strict: "all", // or "none" or "store" or "admin"
        strict: "none",
        identifier: "google",
        clientID: GoogleClientId,
        clientSecret: GoogleClientSecret,
        store: {
          callbackUrl: `${BACKEND_URL}/store/auth/google/cb`,
          failureRedirect: `${STORE_URL}/login`,
          // The success redirect can be overriden from the client by adding a query param `?redirectTo=your_url` to the auth url
          // This query param will have the priority over this configuration
          successRedirect: `${STORE_URL}/`,
          authPath: "/store/auth/google",
          // authCallbackPath: "/store/auth/google/cb",
          // expiresIn: 24 * 60 * 60 * 1000,
          // verifyCallback: (container, req, accessToken, refreshToken, profile, strict) => {
          //    // implement your custom verify callback here if you need it
          // },
          scope: [`email`, `profile`],
        },
      },
    ],
    },
    

  
    5. Google Cloud Developer
        - Set up my credentials
        - Set up my redirect url: Has it to be the callbackUrl or the successRedirect? This is what I've done
        
    6. Setting The login button in the client side
        ```
        <a type="button"
          href="https://medusa14-production.up.railway.app/store/auth/google/" 
          className="text-white bg-[#4285F4] hover:bg-[#4285F4]/90 focus:ring-4 focus:outline-none focus:ring-[#4285F4]/50 font-medium rounded-lg text-sm px-5 py-2.5 text-center inline-flex items-center dark:focus:ring-[#4285F4]/55 mr-2 mb-2"
        >
        ```
        
        
        
###     6. My questions are the following:

        - Shoud the href of the button correspond to the authPath of the plugin 
        - Should be the the redirectUrl equal to the callbackUrl or to the successRedirect?
        - Clicking on the button currently doesn't login the user, it triggers these requests:
        
 Request URL:
https://medusa14-production.up.railway.app/store/auth/google/
Request Method:
GET
Status Code:
302 Found
Failed to load response data: No
content available because this
request was redirected 


Request URL:
https://accounts.google.com/o/oauth2/v2/auth?response_type=code&redirect_uri=https%3A%2F%2Fmedusa14-production.up.railway.app%2Fstore%2Fauth%2Fgoogle%2Fcb&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile&client_id=748180994839-a0uetc4gj7qj3bn5u6evctcr9dhkm99i.apps.googleusercontent.com
Request Method:
GET
Status Code:
302 Found
Failed to load response data: No
content available because this
request was redirected 
            - https://medusa14-production.up.railway.app/store/auth/google/cb?code=4%2F0AfJohXnaYXvsaKX71HhEVBvPVX7x4VH6BCohixOtvP-eFF6eGUMXE_ngeadcij-zG552JQ&scope=email+profile+openid+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&authuser=0&prompt=none
            
            
            
Request Method:
GET
Status Code:
302 Found
Failed to load response data: No
content available because this
request was redirected 

This one is highlighted in red
localhost:8000/?access_token=dummydataxxx
Failed to load response data: No
resource with given identifier found

Thanks for helping me out

Google OAuth login not working for admin

Hello, I am using plugin medusa-plugin-auth for Google OAuth login on admin site (localhost:7000) . My localhost for backend is : localhost:9000

Below are configurations that I have done on my Google Developer Console
image
My admin configurations for the plugin is as following
image

When I click onto the button Login By Google , it redirects me to this screen
image

Can you please let me know which step I am missing ?
Thanks

Issues with version 1.4.5 and 1.4.4

When I try to login with external providers I get this issue on the api:

1|api_v2   |
1|api_v2   | Please migrate your code to use AWS SDK for JavaScript (v3).
1|api_v2   | For more information, check the migration guide at https://a.co/7PzMCcy
1|api_v2   | (Use `node --trace-warnings ...` to show where the warning was created)
1|api_v2   | Error: Unknown authentication strategy "google.store.medusa-auth-plugin"
1|api_v2   |     at attempt (/home/debian/api_v2/node_modules/passport/lib/middleware/authenticate.js:193:39)
1|api_v2   |     at authenticate (/home/debian/api_v2/node_modules/passport/lib/middleware/authenticate.js:370:7)
1|api_v2   |     at Layer.handle [as handle_request] (/home/debian/api_v2/node_modules/express/lib/router/layer.js:95:5)
1|api_v2   |     at next (/home/debian/api_v2/node_modules/express/lib/router/route.js:144:13)
1|api_v2   |     at /home/debian/api_v2/node_modules/medusa-plugin-auth/core/passport/utils/auth-routes-builder.js:39:9
1|api_v2   |     at Layer.handle [as handle_request] (/home/debian/api_v2/node_modules/express/lib/router/layer.js:95:5)
1|api_v2   |     at next (/home/debian/api_v2/node_modules/express/lib/router/route.js:144:13)
1|api_v2   |     at Route.dispatch (/home/debian/api_v2/node_modules/express/lib/router/route.js:114:3)
1|api_v2   |     at Layer.handle [as handle_request] (/home/debian/api_v2/node_modules/express/lib/router/layer.js:95:5)
1|api_v2   |     at /home/debian/api_v2/node_modules/express/lib/router/index.js:284:15

this is my config:

  {
      resolve: "medusa-plugin-auth",
      options: {
          // Enable google OAuth 2
          google: {
              clientID: process.env.GOOGLE_CLIENT_ID | "",
              clientSecret: process.env.GOOGLE_CLIENT_SECRET || "",
              // Enable google OAuth 2 for the admin domain
              admin: {
                  callbackUrl: `${process.env.BACKEND_URL}/admin/auth/google/cb`,
                  failureRedirect: `${process.env.ADMIN_URL}/login`,
                  successRedirect: `${process.env.ADMIN_URL}/`,
                  //authPath: "/admin/auth/google",
                  //authCallbackPath: "/admin/auth/google/cb",
                  //expiresIn: 24 * 60 * 60 * 1000
              },
              // Enable google OAuth 2 for the store domain
              store: {
                  callbackUrl: `${process.env.BACKEND_URL}/store/auth/google/cb`,
                  failureRedirect: `${process.env.STORE_URL}/login`,
                  successRedirect: `${process.env.STORE_URL}/`,
                  authPath: "/store/auth/google",
                  authCallbackPath: "/store/auth/google/cb",
                  //expiresIn: 24 * 60 * 60 * 1000
              }
          },
          facebook: {
              clientID: process.env.FACEBOOK_CLIENT_ID,
              clientSecret: process.env.FACEBOOK_CLIENT_SECRET,
              // Enable facebook OAuth 2 for the admin domain
              admin: {
                  callbackUrl: `${process.env.BACKEND_URL}/admin/auth/facebook/cb`,
                  failureRedirect: `${process.env.ADMIN_URL}/login`,
                  successRedirect: `${process.env.ADMIN_URL}/`,
                  //authPath: "/admin/auth/facebook",
                  //authCallbackPath: "/admin/auth/facebook/cb",
                  //expiresIn: 24 * 60 * 60 * 1000
              },
              // Enable facebook OAuth 2 for the store domain
              store: {
                  callbackUrl: `${process.env.BACKEND_URL}/store/auth/facebook/cb`,
                  failureRedirect: `${process.env.STORE_URL}/login`,
                  successRedirect: `${process.env.STORE_URL}/`,
                  //authPath: "/store/auth/facebook",
                  //authCallbackPath: "/store/auth/facebook/cb",
                  //expiresIn: 24 * 60 * 60 * 1000
              }
          }
      }
  },

and these are my urls:

BACKEND_URL=api.myworkingapionproduction.com
STORE_URL=store.myworkingapionproduction.com
ADMIN_URL=api.myworkingapionproduction.com/app/

also the keys are set, before on earlier versions was working until some other step but now it fails at the beginning

I am using latest medusa version 1.11.1

"Unable to verify authorization request state." during the passport.authenticate()

When using the Auth0 strategy and in production mode (sameSite = none as well), I get the following:

"Unable to verify authorization request state." during the passport.authenticate()

I see that we added "state: true" as part of the strategy, and when I take that out I get

"Error: Scope "openid" is not allowed without Auth0Strategy state true"

This appears to work fine locally.

A little typo?

First of all, you need to install the plugin as follow

yarn add @medusa-plugins/medusa-plugnig-prometheus

Medusa-plugin-auth breaks sign in with user and password.

Bug report

Describe the bug

Hey there, I configured sign in with Google and it works. But now I have a problem, the normal login (user and password) is not working. If I disabled medusa-plugin-auth it works again normal login.

https://github.com/medusajs/medusa/blob/6cea109caa7d859fb3e4dd8beaff3d35246ed8f3/packages/medusa/src/api/routes/store/customers/index.ts#L37

Doing some reach, the problem is there(link above), it changes something so get-customer it's not called. If that line is commented the normal login works and google sign in works but stopped working sign out from the account 🤣

Adrien talk about it in Discord and there is a posible solution.

https://discord.com/channels/876835651130097704/1027894657444741120/1047809668178792450

System information

Medusa version (including plugins): 1.6.5
Node.js version: 14
Database: postgres
Operating system: ubuntu 22.04
Browser (if relevant):

Steps to reproduce the behavior

  1. Go to 'Sign in.'
  2. Write credentials
  3. Click on ''Sign"
  4. It throws an error (customer doesn't exist)
  5. See error

Expected behavior

It's expected to be signed and redirect to home screen already logged.

Screenshots

If applicable, add screenshots to help explain your problem

Code snippets

If applicable, add code samples to help explain your problem

Additional context

Add any other context about the problem here
@adrien2p

Medusa 1.18.1 - Undefined plugin

Env:

  • Node 18.16.1
  • "medusa-plugin-auth": "^1.8.3",
  • "@medusajs/medusa": "1.18.1",

Config setup:
As usual for firebase

 {
    resolve: 'medusa-plugin-auth',
    options: {
      firebase: {
        credentialJsonPath: 'credentials/goloco-715d5-firebase-adminsdk-z7gkn-22da47ded5.json',
        admin: {
          // authPath: '/admin/auth/firebase',
          expiresIn: ONE_MONTH,
        },
        store: {
          // authPath: '/store/auth/firebase',
          expiresIn: ONE_MONTH,
          verifyCallback: async (container, decodedToken) => {
            const email = decodedToken.email;
            const firebaseId = decodedToken.uid;
            const manager = container.resolve('manager');
            const customerService = container.resolve('customerService');

Error:
When yarn build:

➜ yarn build  
yarn run v1.22.19
warning package.json: "dependencies" has dependency "babel-preset-medusa-package" with range "^1.1.13" that collides with a dependency in "devDependencies" of the same name with version "^1.1.19"
$ cross-env npm run clean && npm run build:server && npm run build:admin

> [email protected] clean
> cross-env ./node_modules/.bin/rimraf dist


> [email protected] build:server
> cross-env npm run clean && tsc -p tsconfig.server.json


> [email protected] clean
> cross-env ./node_modules/.bin/rimraf dist


> [email protected] build:admin
> cross-env medusa-admin build

TypeError: Cannot read properties of undefined (reading 'plugins')
    at loadConfig (/Users/anle/Desktop/flip/flip-ticketing-v1/node_modules/@medusajs/admin/utils/load-config.js:8:31)
    at Command.<anonymous> (/Users/anle/Desktop/flip/flip-ticketing-v1/node_modules/@medusajs/admin/commands/build.js:50:49)
    at step (/Users/anle/Desktop/flip/flip-ticketing-v1/node_modules/@medusajs/admin/commands/build.js:33:23)
    at Object.next (/Users/anle/Desktop/flip/flip-ticketing-v1/node_modules/@medusajs/admin/commands/build.js:14:53)
    at /Users/anle/Desktop/flip/flip-ticketing-v1/node_modules/@medusajs/admin/commands/build.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/anle/Desktop/flip/flip-ticketing-v1/node_modules/@medusajs/admin/commands/build.js:4:12)
    at Command.build (/Users/anle/Desktop/flip/flip-ticketing-v1/node_modules/@medusajs/admin/commands/build.js:45:12)
    at Command.listener [as _actionHandler] (/Users/anle/Desktop/flip/flip-ticketing-v1/node_modules/commander/lib/command.js:482:17)
    at /Users/anle/Desktop/flip/flip-ticketing-v1/node_modules/commander/lib/command.js:1283:65
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Error when sign in/sign up for a guest

If a user has an order as a guest before, then signing in/signing up with Google (using the Gmail that they used in the Guest order), the response is customer already exists as a Guest.

Is this on purpose or any way to get around this so that if a Guest decides to sign up/sign in with Google, their user role on Medusa will switch from Guest to Registered?

Thank you.

Conditionally redirecting to Auth0 Sign Up Page

Is there a way to have medusa-plugin-auth/Passport conditionally redirect users to the Auth0 sign up page rather than to the login page? It looks like if you pass ?screen_hint=signup to the Auth0 /authorize endpoint, users will be routed to the signup page (source). Unsure if there's a way to configure that query parameter within our Medusa app and pass it all the way through to the actual Auth0 url right now though.

Add emailVerified to metadata as part of Auth0 strategy

Auth0 already has a field reflecting whether or not the email of the user has been verified. Would be nice to add that to the metadata object to expose it in the storefront. This is relevant to prompt the user to verify their e-mail and/or disabling parts of the user dashboard based on this property.

An error occurred while registering endpoints in medusa-plugin-auth TypeError: app.use() requires a middleware function

I'm getting this error i'm using medusa 1.19

warn:    An error occurred while registering endpoints in medusa-plugin-auth
warn:    TypeError: app.use() requires a middleware function
    at Function.use (/Users/lucjangrzesik/Desktop/retrobroker/server/node_modules/express/lib/application.js:217:11)
    at /Users/lucjangrzesik/Desktop/retrobroker/server/node_modules/@medusajs/medusa/dist/loaders/plugins.js:436:37
    at step (/Users/lucjangrzesik/Desktop/retrobroker/server/node_modules/@medusajs/medusa/dist/loaders/plugins.js:56:23)
    at Object.next (/Users/lucjangrzesik/Desktop/retrobroker/server/node_modules/@medusajs/medusa/dist/loaders/plugins.js:37:53)
⠹ Initializing plugins

my config

{
    resolve: "medusa-plugin-auth",
    /** @type {import('medusa-plugin-auth').AuthOptions} */
    options: {
      // strict: "all", // or "none" or "store" or "admin"
      google: {
        clientID: GoogleClientId,
        clientSecret: GoogleClientSecret,

        admin: {
          callbackUrl: `${BACKEND_URL}/admin/auth/google/cb`,
          failureRedirect: `${ADMIN_URL}/login`,

          // The success redirect can be overriden from the client by adding a query param `?redirectTo=your_url` to the auth url
          // This query param will have the priority over this configuration
          successRedirect: `${ADMIN_URL}/`,

          authPath: '/admin/auth/google',
          // authCallbackPath: '/admin/auth/google/cb',
          // expiresIn: 24 * 60 * 60 * 1000,
          // verifyCallback: (container, req, accessToken, refreshToken, profile, strict) => {
          //    // implement your custom verify callback here if you need it
          // }
        },

        store: {
          callbackUrl: `${BACKEND_URL}/store/auth/google/cb`,
          failureRedirect: `${STORE_URL}/login`,

          // The success redirect can be overriden from the client by adding a query param `?redirectTo=your_url` to the auth url
          // This query param will have the priority over this configuration
          successRedirect: `${STORE_URL}/`,

          authPath: '/store/auth/google',
          authCallbackPath: '/store/auth/google/cb',
          // expiresIn: 24 * 60 * 60 * 1000,
          // verifyCallback: (container, req, accessToken, refreshToken, profile, strict) => {
          //     console.log('verifyCallback')
          //     console.log(profile)
          //     console.log(accessToken)
          //     console.log(refreshToken)

          //    // implement your custom verify callback here if you need it
          // }
        }
      }
    }
  },

social login returns {"exist": false}

I'm trying to integrate google and facebook sign ups and whenever I hit the auth path, I get this response:
{ "exists": false }

It was working well back in November, haven't updated the package or changed any config in google cloud platform or meta developer account
System information

Medusa version (including plugins): v1.17.4
medusa-plugin-auth: v1.8.3

Screenshot (313)

Screenshot 2024-01-10 151137

google auht redirect

after google authentication i am getting redirect to this page instead of my storefront
redirect

medusa-plugin-auth plugin not working with latest version of medusa.

Unable to use medusa-plugin-auth getting following error while using it.

warn: An error occurred while registering endpoints in medusa-plugin-auth
warn: TypeError: app.use() requires a middleware function
at Function.use (/Users/yag/Documents/projects/my-medusa-store/node_modules/express/lib/application.js:217:11)
at /Users/yag/Documents/projects/my-medusa-store/node_modules/@medusajs/medusa/dist/loaders/plugins.js:376:37
at step (/Users/yag/Documents/projects/my-medusa-store/node_modules/@medusajs/medusa/dist/loaders/plugins.js:33:23)
at Object.next (/Users/yag/Documents/projects/my-medusa-store/node_modules/@medusajs/medusa/dist/loaders/plugins.js:14:53)

medusa-plugin-sentry > Admin UI routing support for latest version

The documentation for adding sentry to admin-ui says

Open the src/pages/a.js
Next, add the following code to the Routes component...

I don't seem to have a pages directory, just a src/admin/routes as defined here. I don't seem to have a Routes component. I am very new to medusa and could be wrong but I suspect the way medusa is routing has changed since this module was released? Could medusa-plugin-sentry admin ui documentation be updated to support latest current medusa?

Thanks for your help.

versions

    "@medusajs/admin": "^7.1.9",
    "@medusajs/medusa": "^1.7.0",
    "@medusajs/ui": "^2.2.0",
    "@medusajs/ui-preset": "1.0.2",

Cannot register if order is made as guest

medusa-plugin-auth
I'm receiving Internal Server Error if I'm trying to register after I have made an order without registration

Error: Guest customer with email already exists
at CustomerService.<anonymous> (/app/node_modules/@medusajs/medusa/dist/services/customer.js:419:55)
at step (/app/node_modules/@medusajs/medusa/dist/services/customer.js:59:23)
at Object.next (/app/node_modules/@medusajs/medusa/dist/services/customer.js:40:53)
at fulfilled (/app/node_modules/@medusajs/medusa/dist/services/customer.js:31:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
```

Error: Unknown authentication strategy "firebase.store.medusa-auth-plugin"

Hi, I am getting unknown authentication strategy.

My config:


const plugins = [
  `medusa-fulfillment-manual`,
  `medusa-payment-manual`,
  // To enable the admin plugin, uncomment the following lines and run `yarn add @medusajs/admin`
  {
    resolve: "@medusajs/admin",
    /** @type {import('@medusajs/admin').PluginOptions} */
    options: {
      autoRebuild: true,
    },
  },
  {
    resolve: "medusa-plugin-auth",
    options: {
      firebase: {
        credentialJsonPath: CredentialJsonPath,
        store: {
          authPath: '/store/auth/firebase', 
        }
      }
    }
  },
  {
    resolve: `medusa-payment-stripe`,
    options: {
      api_key: process.env.STRIPE_API_KEY,
      webhook_secret: process.env.STRIPE_WEBHOOK_SECRET,
    },
  },
];


    "@medusajs/admin": "^5.0.0",
    "@medusajs/cache-inmemory": "^1.8.6",
    "@medusajs/cache-redis": "^1.8.6",
    "@medusajs/event-bus-local": "^1.9.3",
    "@medusajs/event-bus-redis": "^1.8.6",
    "@medusajs/medusa": "^1.11.0",
    "@medusajs/medusa-cli": "^1.3.14",
    "babel-preset-medusa-package": "^1.1.13",
    "body-parser": "^1.19.0",
    "cors": "^2.8.5",
    "express": "^4.17.2",
    "medusa-fulfillment-manual": "^1.1.37",
    "medusa-interfaces": "^1.3.7",
    "medusa-payment-manual": "^1.0.23",
    "medusa-payment-stripe": "^5.0.0",
    "medusa-plugin-auth": "^1.4.5",
    "typeorm": "^0.3.16"

How to support multiple/dynamic store URLs in successRedirect?

The plugin requires the following configuration:

options: {
      auth0: {
        clientID: Auth0ClientId,
        clientSecret: Auth0ClientSecret,
        auth0Domain: Auth0Domain,

        admin: {
          callbackUrl: `${BACKEND_URL}/admin/auth/auth0/cb`,
          failureRedirect: `${ADMIN_URL}/login`,
          successRedirect: `${ADMIN_URL}/`,
          // authPath: '/admin/auth/auth0',
          // authCallbackPath: '/admin/auth/auth0/cb',
          // expiresIn: 24 * 60 * 60 * 1000,
          // verifyCallback: (container, req, accessToken, refreshToken, extraParams, profile) => {
          // implement your custom verify callback here if you need it
          //    // console.log(container, req, accessToken, refreshToken, extraParams, profile)
          // }
        },

      store: {
          callbackUrl: `${BACKEND_URL}/admin/auth/auth0/cb`,
          failureRedirect: `${STORE_URL}/login`,
          successRedirect: `${STORE_URL}/`,
          // authPath: '/admin/auth/auth0',
          // authCallbackPath: '/admin/auth/auth0/cb',
          // expiresIn: 24 * 60 * 60 * 1000,
          // verifyCallback: (container, req, accessToken, refreshToken, extraParams, profile) => {
          // implement your custom verify callback here if you need it
          //    // console.log(container, req, accessToken, refreshToken, extraParams, profile)
          // }
        },
}

Is it possible to support multiple successRedirect so that we can work with Vercel Preview environments for the store? Or a way to dynamically set this on a route handler?
Of course for production we'll have a single one and that's the most secure option, but for preview environments we don't really care about this and it makes development/testing much easier if we are not constrained to a single redirect URL.

Login Success but still 401

when i login with google, it already success, but when it return to admin dashboard it have 401, already go to localhost:7001/a/products but then it go to 401, how i can login to admin dashboard with google?
image
image

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.