Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add raw response to handleError + additional API methods #2

Merged
merged 1 commit into from
Jan 28, 2016

Conversation

ghost
Copy link

@ghost ghost commented Jan 27, 2015

We need the raw response (regToken etc...) when an error occured and some additional API methods for a project we are doing.
Is it possible to publish this to the public npm registry?

@scotthovestadt
Copy link
Owner

Hi.

I'll definitely get your commit added to the NPM registry, including the methods that I didn't add to the SDK.

Can you help me understand your use-case for including the raw JSON? The err object should essentially be a parsed version of the JSON at that point, including data on errors that is specific to a method (like validation errors).

There shouldn't be a difference between the JSON and the err object.

@ghost
Copy link
Author

ghost commented Jan 28, 2015

Hi Scott,

The reason we want access to the raw JSON is that the parsed error this lib returns doesn't contain all the data we want. I.e. Sometimes an errorCode ( != 0 ) is returned but the raw json contains a gigya user object (with UID, Signature, regToken). We want access to this userData regardless whether an error occured or not. Right now, in case of an errCode all we get is this:

 var e = new Error(json.errorDetails);
e.code = json.errorCode;
e.callId = json.callId;

The JSON returned from the gigya does contain a lot more information that is useful to us.
Like in the case of a errorCode 2006001 (Account Pending Registration) Gigya returns the user associated with this account. And we need this for our user login flow. Now all we get is a stripped down error object from this library.

Does that clarify our needs? Thanks!

{ UID: '61cb5a6c9cfa49c1aeae28b00c2b4a79',
  UIDSignature: 'YcH8KxiBYTFsUC8V48zgtJTmc3k=',
  signatureTimestamp: '1422433762',
  loginProvider: 'site',
  isRegistered: false,
  isActive: true,
  isLockedOut: false,
  isVerified: true,
  socialProviders: 'site',
  identities: 
   [ { provider: 'site',
       providerUID: '61cb5a6c9cfa49c1aeae28b00c2b4a79',
       isLoginIdentity: true,
       email: '[email protected]',
       allowsLogin: true,
       isExpiredSession: false,
       lastUpdated: '2015-01-27T13:16:25.803Z',
       lastUpdatedTimestamp: 1422364585803,
       oldestDataUpdated: '2015-01-27T13:16:25.803Z',
       oldestDataUpdatedTimestamp: 1422364585803 } ],
  created: '2015-01-27T13:16:25.771Z',
  createdTimestamp: 1422364585771,
  lastLogin: '2015-01-28T08:29:22.122Z',
  lastLoginTimestamp: 1422433762122,
  lastUpdated: '2015-01-27T13:16:25.803Z',
  lastUpdatedTimestamp: 1422364585803,
  oldestDataUpdated: '2015-01-27T13:16:25.803Z',
  oldestDataUpdatedTimestamp: 1422364585803,
  verified: '2015-01-27T13:17:56.821Z',
  verifiedTimestamp: 1422364676821,
  regToken: 'RT1_stCAQRTU1RLBzY0MjUzMzEBAAAAAADAAQAAVM44ZkMYqJhdrBRFthCYaAKWyn0wRbM4ZIlpWA2qoaDigfnqoyi6rkjrpt2_24UnMQQIIoaUmnkehSiZTbLTZHCBXTGumrpWq0i4c154k2sy0Gf7fi--IT4g1ekeJJWMtKPt_2TXq4kl_fkQyXAdXc0ykZC1Zi0jX4Vxo3z0qMp8jaLdz3XqWX7hE_oNGFYXDN6ouzeS8PfvygiprhwxW3L7bj5Ym27rUemplrOTQHtdAd0C3TSctH5G5Rk92NBM5V1QRif4J6Pzp_gIBEBKxaw8mP6oXMQdrtQP5RZoN-9DCjPLorbcP77D2tP4YDY8W6TL1VlvE7YmSCKgGwJ4qKIxRzwh_wXMpVeYlr9v6oA4BZDv7s_z0FUYBm-ZQDGhH3_1Jtsev0fpB8YdpjkIk7EIZLqkyVju3NW3Xengb4XNp3x26j6ZkFz4CqpLWuwwZxz2am-vqKy1sIu1ibQj1wF4TWrXRqFjNa7HV8DduVcOIo3E49oRvmG-uh29kywDctN-wOxC-Q9k7xcvtI9zWImFcgBisGmAM9cyFdC6QRhVBSo5M9-SW1OD-v5FHGcXhDZnUgo4zB0m4bmyb2FSNBAAAAD7C-ZeWgpFTrB4PFD1TDR4',
  errorDetails: 'Missing required fields for registration: birthYear,country,gender,zip',
  errorMessage: 'Account Pending Registration',
  statusCode: 206,
  errorCode: 206001,
  statusReason: 'Partial Content',
  callId: '20e22af6bea04d28ace574b346243e77' }

@scotthovestadt
Copy link
Owner

I'll fix it so the error object includes everything. I'll also add the missing methods to the SDK.

@ghost
Copy link
Author

ghost commented Sep 7, 2015

Hi scott,

Any news on this issue?

Thanks,

Ilja

scotthovestadt added a commit that referenced this pull request Jan 28, 2016
Add raw response to handleError + additional API methods.
@scotthovestadt scotthovestadt merged commit 8309dad into scotthovestadt:master Jan 28, 2016
@scotthovestadt
Copy link
Owner

Merged. Thanks!

@ghost
Copy link
Author

ghost commented Jan 28, 2016

Thanks! I will remove our fork and depend on [email protected].

Kind regards,

I

On Thu, Jan 28, 2016 at 11:07 PM, scotthovestadt [email protected]
wrote:

Merged. Thanks!


Reply to this email directly or view it on GitHub
#2 (comment)
.

iBaryo pushed a commit that referenced this pull request Jul 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants