jproulx / Gigya-Node-SDK

Node module that wraps around Gigya's public REST API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gigya requires data center as a part of the URL for the API request.

chronosis opened this issue · comments

Gigya now requires that API calls now be made against the associated data centers.

For example, if the Gigya API key is on the U.S. datacenter, and you are accessing the accounts service, than the URL for the REST endpoint should be: accounts.us1.gigya.com instead of accounts.gigya.com

Making calls to accounts.gigya.com is still supported for legacy reasons, but API calls made in this way will be crippled due to rate limiting that is enforced by Gigya.

You should update your defaults to include a datacenter (https://github.com/jproulx/Gigya-Node-SDK/blob/master/gigyasdk.js#L192-L20):

        defaults = {
            'apiKey'    : null,
            'secret'    : null,
            'domain'    : 'gigya.com',
            'datacenter'    : 'us1',
            'service'   : 'socialize',
            'method'    : null,
            'reqMethod' : 'GET',
            'nonceSize' : 32,
            'ssl'       : false
        };

And your code that generated the request (https://github.com/jproulx/Gigya-Node-SDK/blob/master/gigyasdk.js#L245-L251):

    request = {
        'host'    : [opts.service, opts.datacenter, opts.domain].join('.'),
        'path'    : '/' + [opts.service, opts.method].join('.'),
        'method'  : opts.reqMethod,
        'headers' : {
            'User-Agent' : 'Node-Gigya-SDK'
        }

Valid data centers are:
Region -- Data Center
U.S. -- us1
Europe -- eu1
Oceanic -- au1 (Available Nov. 2014)

A pull request would be welcome, additionally I haven't used Gigya in 4 years so it would take me a while to test and verify.

Merged, thank you!