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

To help you get started, we’ve selected a few @commercetools/sdk-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.it.js View on Github external
it('should throw invalid client credentials error', async () => {
      const _apiConfig = {
        ...apiConfig,
        credentials: {
          clientId: 'invalidClientId',
          clientSecret: 'invalidClientSecret',
        },
      }
      const _authClient = new SdkAuth(_apiConfig)

      try {
        await _authClient.clientCredentialsFlow()
        throw new Error('Should throw an error')
      } catch (err) {
        expect(err).toEqual({
          code: 401,
          statusCode: 401,
          status: 401,
          message:
            'Please provide valid client credentials using HTTP Basic Authentication.',
          errors: [
            {
              code: 'invalid_client',
              message:
                'Please provide valid client credentials using HTTP Basic Authentication.',
github commercetools / nodejs / integration-tests / sdk / auth.it.js View on Github external
beforeEach(() => {
    authClient = new SdkAuth(apiConfig)
  })

@commercetools/sdk-auth

Auth module for different authentication flows of commercetools platform API

MIT
Latest version published 1 year ago

Package Health Score

63 / 100
Full package analysis

Popular @commercetools/sdk-auth functions