scotthovestadt / gigya

Gigya JavaScript REST SDK
MIT License
37 stars 62 forks source link

Missing required parameter: ApiKey #29

Closed RidgeA closed 5 years ago

RidgeA commented 5 years ago

Affected version - 2.0.37. Not reproduced at 2.0.35 version.

When I making a request, e.g. accounts.login I getting an error:

Missing required parameter: ApiKey

Running with NODE_DEBUG=request showed:

REQUEST { method: 'POST',
   form: 
    { loginID: 'xxx@gmail.com',
      password: 'xxx',
      format: 'json',
      secret: 'xxx',
      userKey: 'xxx' },

There is no API key indeed.

I think it happens because of this commit: https://github.com/scotthovestadt/gigya/commit/45a6b818083fb47942ca2d305855de4daae20728

            if (isAdminEndpoint && !userParams.apiKey && this.apiKey) {
                requestParams['apiKey'] = this.apiKey;
            }

What if isAdminEndpoint === false ?

iBaryo commented 5 years ago

sorry - should've been !isAdminEndpoint. published to npm: 2.0.37

RidgeA commented 5 years ago

@iBaryo thanks! 2.0.38 ?

iBaryo commented 5 years ago

yep!

AleDarko commented 5 years ago

Hi, I have the same problem with version 2.0.39 and I fixed it temporarily by setting !IsAdminEndpoint

// Add API key to request if not provided. if (!isAdminEndpoint && !userParams.apiKey && this.apiKey) { requestParams['apiKey'] = this.apiKey; }

is it possible to fix?

Regards

iBaryo commented 5 years ago

sorry, slight mix up as the fix was reverted - fixed in 2.0.40