How to use the @commercetools/sdk-middleware-auth.createAuthMiddlewareForPasswordFlow function in @commercetools/sdk-middleware-auth

To help you get started, we’ve selected a few @commercetools/sdk-middleware-auth examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commercetools / nodejs / integration-tests / sdk / auth-middleware.it.js View on Github external
...{ scopes: [`manage_project:${projectKey}`] },
        ...{
          credentials: {
            clientId: apiConfig.credentials.clientId,
            clientSecret: apiConfig.credentials.clientSecret,
            user: {
              username: userEmail,
              password: userPassword,
            },
          },
        },
        fetch,
      }
      const client = createClient({
        middlewares: [
          createAuthMiddlewareForPasswordFlow(userConfig),
          httpMiddleware,
        ],
      })
      return client
        .execute({
          uri: `/${projectKey}/me`,
          method: 'GET',
        })
        .then(response => {
          const user = response.body
          expect(user).toHaveProperty('email', userEmail)
        })
    })
  })